More force crash on failed initial load packet
This commit is contained in:
7
src/main/java/me/cortex/voxy/client/LoadException.java
Normal file
7
src/main/java/me/cortex/voxy/client/LoadException.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package me.cortex.voxy.client;
|
||||
|
||||
public class LoadException extends RuntimeException {
|
||||
public LoadException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.cortex.voxy.client.mixin.minecraft;
|
||||
|
||||
import me.cortex.voxy.client.LoadException;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
@@ -14,11 +15,7 @@ public class MixinClientCommonNetworkHandler {
|
||||
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);
|
||||
//}
|
||||
throw new LoadException("Force crashing due to exception during on game join", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package me.cortex.voxy.client.mixin.minecraft;
|
||||
|
||||
import me.cortex.voxy.client.LoadException;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
import net.minecraft.util.thread.ThreadExecutor;
|
||||
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(ThreadExecutor.class)
|
||||
public abstract class MixinThreadExecutor {
|
||||
@Shadow public static boolean isMemoryError(Throwable exception){return false;};
|
||||
|
||||
@Redirect(method = "executeTask", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/thread/ThreadExecutor;isMemoryError(Ljava/lang/Throwable;)Z"), remap = false)
|
||||
private boolean voxy$forceCrashOnError(Throwable exception) {
|
||||
if (exception instanceof LoadException le) {
|
||||
if (le.getCause() instanceof RuntimeException cause) {
|
||||
throw cause;
|
||||
}
|
||||
throw le;
|
||||
}
|
||||
return isMemoryError(exception);
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
"client": [
|
||||
"chunky.MixinFabricWorld",
|
||||
"joml.AccessFrustumIntersection",
|
||||
"minecraft.MixinClientCommonNetworkHandler",
|
||||
"minecraft.MixinThreadExecutor",
|
||||
"minecraft.MixinDebugHud",
|
||||
"minecraft.MixinMinecraftClient",
|
||||
"minecraft.MixinWorldRenderer",
|
||||
"minecraft.MixinClientCommonNetworkHandler",
|
||||
"sodium.MixinDefaultChunkRenderer",
|
||||
"sodium.MixinRenderSectionManager"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user