Skip to content

Commit

Permalink
Log connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 14, 2024
1 parent d0aec6f commit 62f29a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package xyz.nucleoid.extras.mixin.debug;

import io.netty.handler.timeout.TimeoutException;
import net.minecraft.network.ClientConnection;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ClientConnection.class)
public class ClientConnectionMixin {
@Redirect(method = "exceptionCaught", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;debug(Ljava/lang/String;Ljava/lang/Throwable;)V"))
private void printError(Logger instance, String s, Throwable throwable) {
if (throwable instanceof TimeoutException) {
return;
}
instance.error(s, throwable);
}
}
1 change: 1 addition & 0 deletions src/main/resources/extras.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"compat.ServerWorldMixin",
"datafixer.ItemStackComponentizationFixMixin",
"datafixer.Schema1460Mixin",
"debug.ClientConnectionMixin",
"debug.EntityMixin",
"lobby.ArmorStandEntityAccessor",
"lobby.BeaconBlockEntityMixin",
Expand Down

0 comments on commit 62f29a2

Please sign in to comment.