diff --git a/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/mixin/debug/client/MixinClientConnection.java b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..a005001 --- /dev/null +++ b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc114.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc114/src/main/resources/mixins.viafabric114.debug.json b/viafabric-mc114/src/main/resources/mixins.viafabric114.debug.json index f450160..9d97f6c 100644 --- a/viafabric-mc114/src/main/resources/mixins.viafabric114.debug.json +++ b/viafabric-mc114/src/main/resources/mixins.viafabric114.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/mixin/debug/client/MixinClientConnection.java b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..96169f4 --- /dev/null +++ b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc115.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc115/src/main/resources/mixins.viafabric115.debug.json b/viafabric-mc115/src/main/resources/mixins.viafabric115.debug.json index a15fd11..b1ff950 100644 --- a/viafabric-mc115/src/main/resources/mixins.viafabric115.debug.json +++ b/viafabric-mc115/src/main/resources/mixins.viafabric115.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/mixin/debug/client/MixinClientConnection.java b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..1cfde13 --- /dev/null +++ b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc116.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc116/src/main/resources/mixins.viafabric116.debug.json b/viafabric-mc116/src/main/resources/mixins.viafabric116.debug.json index c42541b..27c7410 100644 --- a/viafabric-mc116/src/main/resources/mixins.viafabric116.debug.json +++ b/viafabric-mc116/src/main/resources/mixins.viafabric116.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/mixin/debug/client/MixinClientConnection.java b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..fa16dd4 --- /dev/null +++ b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc117.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc117/src/main/resources/mixins.viafabric117.debug.json b/viafabric-mc117/src/main/resources/mixins.viafabric117.debug.json index eb4ce98..b1380f2 100644 --- a/viafabric-mc117/src/main/resources/mixins.viafabric117.debug.json +++ b/viafabric-mc117/src/main/resources/mixins.viafabric117.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/mixin/debug/client/MixinClientConnection.java b/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..d6e0f5d --- /dev/null +++ b/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc118.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc118/src/main/resources/mixins.viafabric118.debug.json b/viafabric-mc118/src/main/resources/mixins.viafabric118.debug.json index 2c0bd5e..a08c985 100644 --- a/viafabric-mc118/src/main/resources/mixins.viafabric118.debug.json +++ b/viafabric-mc118/src/main/resources/mixins.viafabric118.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/mixin/debug/client/MixinClientConnection.java b/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..dc1436f --- /dev/null +++ b/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc119.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc119/src/main/resources/mixins.viafabric119.debug.json b/viafabric-mc119/src/main/resources/mixins.viafabric119.debug.json index b7b4fc6..76d7d71 100644 --- a/viafabric-mc119/src/main/resources/mixins.viafabric119.debug.json +++ b/viafabric-mc119/src/main/resources/mixins.viafabric119.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0 diff --git a/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/mixin/debug/client/MixinClientConnection.java b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/mixin/debug/client/MixinClientConnection.java new file mode 100644 index 0000000..03410e8 --- /dev/null +++ b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/mixin/debug/client/MixinClientConnection.java @@ -0,0 +1,24 @@ +package com.viaversion.fabric.mc18.mixin.debug.client; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.ClientConnection; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Final; +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.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ClientConnection.class) +public abstract class MixinClientConnection { + + @Shadow + @Final + private static Logger LOGGER; + + @Inject(method = "exceptionCaught", at = @At("TAIL")) + public void exceptionCaught(ChannelHandlerContext context, Throwable ex, CallbackInfo ci) { + LOGGER.error("Packet error", ex); + } +} diff --git a/viafabric-mc18/src/main/resources/mixins.viafabric18.debug.json b/viafabric-mc18/src/main/resources/mixins.viafabric18.debug.json index 0d7a00a..ee69186 100644 --- a/viafabric-mc18/src/main/resources/mixins.viafabric18.debug.json +++ b/viafabric-mc18/src/main/resources/mixins.viafabric18.debug.json @@ -6,7 +6,8 @@ ], "client": [ "client.MixinClientConnectionAccessor", - "client.MixinDebugHud" + "client.MixinDebugHud", + "client.MixinClientConnection" ], "injectors": { "defaultRequire": 0