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 00000000..a0050016 --- /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 f450160e..9d97f6c9 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 00000000..96169f44 --- /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 a15fd117..b1ff950a 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 00000000..1cfde13d --- /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 c42541b8..27c74108 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 00000000..fa16dd4e --- /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 eb4ce988..b1380f23 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 00000000..d6e0f5dd --- /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 2c0bd5ec..a08c985b 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 00000000..dc1436f2 --- /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 b7b4fc6a..76d7d712 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 00000000..03410e81 --- /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 0d7a00af..ee691868 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