Allow climbing while flying in <= 1.21.3

This commit is contained in:
FlorianMichael 2024-12-07 00:36:38 +01:00
parent 9c346cae39
commit 228297d65a
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 7 additions and 1 deletions

View File

@ -34,7 +34,6 @@ import java.util.concurrent.CompletableFuture;
/* /*
* TODO | Port 1.21.4 * TODO | Port 1.21.4
* - PlayerEntity#isClimbing override
* - PlayerEntity#tick -> hasVehicle check at the top * - PlayerEntity#tick -> hasVehicle check at the top
* - Entity#move * - Entity#move
* - LivingEntity#baseTick * - LivingEntity#baseTick

View File

@ -82,6 +82,13 @@ public abstract class MixinPlayerEntity extends LivingEntity {
super(entityType, world); super(entityType, world);
} }
@Inject(method = "isClimbing", at = @At("HEAD"), cancellable = true)
public void allowClimbingWhileFlying(CallbackInfoReturnable<Boolean> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) {
cir.setReturnValue(super.isClimbing());
}
}
@Inject(method = "isLoaded", at = @At("HEAD"), cancellable = true) @Inject(method = "isLoaded", at = @At("HEAD"), cancellable = true)
public void alwaysLoadPlayer(CallbackInfoReturnable<Boolean> cir) { public void alwaysLoadPlayer(CallbackInfoReturnable<Boolean> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21_2)) {