]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/mixin/network/play/client/MixinCPacketCustomPayload.java
Upgrade to 1.14.2
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / mixin / network / play / client / MixinCPacketCustomPayload.java
index 93249604270f5b833f34c2918166392aea8633af..2bcbd71cda3b202028a274b33e8a2200fbbffc72 100644 (file)
@@ -1,28 +1,25 @@
 package com.irtimaled.bbor.mixin.network.play.client;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.events.PlayerSubscribed;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import com.irtimaled.bbor.common.messages.SubscribeToServer;
-import com.irtimaled.bbor.common.models.ServerPlayer;
-import net.minecraft.network.NetHandlerPlayServer;
-import net.minecraft.network.play.INetHandlerPlayServer;
-import net.minecraft.network.play.client.CPacketCustomPayload;
+import net.minecraft.network.play.IServerPlayNetHandler;
+import net.minecraft.network.play.ServerPlayNetHandler;
+import net.minecraft.network.play.client.CCustomPayloadPacket;
 import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Redirect;
 
-@Mixin(CPacketCustomPayload.class)
+@Mixin(CCustomPayloadPacket.class)
 public class MixinCPacketCustomPayload {
     @Shadow
     private ResourceLocation channel;
 
-    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/INetHandlerPlayServer;processCustomPayload(Lnet/minecraft/network/play/client/CPacketCustomPayload;)V"))
-    private void processPacket(INetHandlerPlayServer netHandlerPlayServer, CPacketCustomPayload packet) {
+    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/IServerPlayNetHandler;processCustomPayload(Lnet/minecraft/network/play/client/CCustomPayloadPacket;)V"))
+    private void processPacket(IServerPlayNetHandler netHandlerPlayServer, CCustomPayloadPacket packet) {
         if (this.channel.toString().equals(SubscribeToServer.NAME)) {
-            ServerPlayer player = new ServerPlayer(((NetHandlerPlayServer) netHandlerPlayServer).player);
-            EventBus.publish(new PlayerSubscribed(player));
+            CommonInterop.playerSubscribed(((ServerPlayNetHandler) netHandlerPlayServer).player);
         } else {
             netHandlerPlayServer.processCustomPayload(packet);
         }