From 228297d65ab749ebbe84f8f77701e2aeeb5b293d Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sat, 7 Dec 2024 00:36:38 +0100 Subject: [PATCH] Allow climbing while flying in <= 1.21.3 --- .../de/florianmichael/viafabricplus/ViaFabricPlus.java | 1 - .../mixin/fixes/minecraft/entity/MixinPlayerEntity.java | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java index 661011e9..ed6b9b09 100644 --- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java +++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java @@ -34,7 +34,6 @@ import java.util.concurrent.CompletableFuture; /* * TODO | Port 1.21.4 - * - PlayerEntity#isClimbing override * - PlayerEntity#tick -> hasVehicle check at the top * - Entity#move * - LivingEntity#baseTick diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java index 4f2dbc2d..c71547e7 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java @@ -82,6 +82,13 @@ public abstract class MixinPlayerEntity extends LivingEntity { super(entityType, world); } + @Inject(method = "isClimbing", at = @At("HEAD"), cancellable = true) + public void allowClimbingWhileFlying(CallbackInfoReturnable cir) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) { + cir.setReturnValue(super.isClimbing()); + } + } + @Inject(method = "isLoaded", at = @At("HEAD"), cancellable = true) public void alwaysLoadPlayer(CallbackInfoReturnable cir) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) {