Force crash on join game packet failure
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package me.cortex.voxy.client.mixin.minecraft;
|
||||
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public class MixinClientCommonNetworkHandler {
|
||||
@Inject(method = "onPacketException", at = @At("HEAD"), cancellable = true)
|
||||
private void handleDisconnectAsCrash(Packet<?> packet, Exception exception, CallbackInfo ci) {
|
||||
if (packet instanceof GameJoinS2CPacket) {
|
||||
ci.cancel();
|
||||
if (exception instanceof RuntimeException re) {
|
||||
throw re;
|
||||
} else {
|
||||
throw new RuntimeException("Force crashing due to exception during on game join", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"minecraft.MixinDebugHud",
|
||||
"minecraft.MixinMinecraftClient",
|
||||
"minecraft.MixinWorldRenderer",
|
||||
"minecraft.MixinClientCommonNetworkHandler",
|
||||
"sodium.MixinDefaultChunkRenderer",
|
||||
"sodium.MixinRenderSectionManager"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user