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 793664c60..6509915b5 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 @@ -183,15 +183,6 @@ public boolean removeVehicleRequirement(ClientPlayerEntity instance) { return instance.hasVehicle(); } - @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;checkFallFlying()Z")) - public boolean makeElytraMovementServerside(ClientPlayerEntity instance) { - // Elytra movement was serverside in <= 1.14.4 and got moved to the client in 1.15 - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) { - return !this.isOnGround() && this.getVelocity().y < 0.0 && !isFallFlying(); - } - return instance.checkFallFlying(); - } - @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isClimbing()Z")) public boolean removeLadderCheck(ClientPlayerEntity instance) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_15_1)) { 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 1e12239fd..bcc3a6176 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 @@ -17,6 +17,7 @@ */ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; +import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.*; import net.minecraft.util.Hand; import net.raphimc.vialoader.util.VersionEnum; @@ -133,4 +134,12 @@ public boolean useOldField(PlayerEntity instance) { } return instance.isSprinting(); } + + @Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true) + public void makeElytraMovementServerside(CallbackInfoReturnable cir) { + // Elytra movement was serverside in <= 1.14.4 and got moved to the client in 1.15 + if ((Object) this instanceof ClientPlayerEntity && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) { + cir.setReturnValue(!this.isOnGround() && this.getVelocity().y < 0.0 && !isFallFlying()); + } + } }