From 8f9ab00b946c017fd1d8256dba1cf40a225a891f Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 26 May 2024 15:52:34 +0200 Subject: [PATCH] Handle more 1.20.3->.5 changes --- .../minecraft/entity/MixinClientPlayerEntity.java | 5 +++++ .../network/MixinClientPlayNetworkHandler.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java index b70092c5..815ac5a6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java @@ -76,6 +76,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity @Shadow public abstract void setClientPermissionLevel(int clientPermissionLevel); + @WrapWithCondition(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;jump()V")) + private boolean dontJump(ClientPlayerEntity instance) { + return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20_5); + } + @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasVehicle()Z", ordinal = 0)) private boolean removeVehicleRequirement(ClientPlayerEntity instance) { return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_20) && instance.hasVehicle(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java index 63fae50b..a17b8f22 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/network/MixinClientPlayNetworkHandler.java @@ -86,6 +86,20 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5); } + @Inject(method = "onEnterReconfiguration", at = @At("HEAD")) + private void disableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + this.connection.channel.config().setAutoRead(false); + } + } + + @Inject(method = "onEnterReconfiguration", at = @At("RETURN")) + private void enableAutoRead(EnterReconfigurationS2CPacket packet, CallbackInfo ci) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) { + this.connection.channel.config().setAutoRead(true); + } + } + @Redirect(method = "sendChatCommand", at = @At(value = "INVOKE", target = "Ljava/util/List;isEmpty()Z")) private boolean alwaysSignCommands(List instance) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {