diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java index 02f36197..0616d35d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinEntity.java @@ -74,17 +74,16 @@ public abstract class MixinEntity { } @Inject(method = "getVelocityAffectingPos", at = @At("HEAD"), cancellable = true) - public void injectGetVelocityAffectingPos(CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) { - cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 0.5000001, pos.z)); - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_14_4)) { - cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - 1, pos.z)); - } + public void replaceAffectingVelocityMagnitude(CallbackInfoReturnable cir) { + final VersionEnum target = ProtocolHack.getTargetVersion(); + + if (target.isOlderThanOrEqualTo(VersionEnum.r1_19_4)) { + cir.setReturnValue(BlockPos.ofFloored(pos.x, getBoundingBox().minY - (target.isOlderThanOrEqualTo(VersionEnum.r1_14_4) ? 1 : 0.5000001), pos.z)); } } @Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true) - public void onGetRotationVector(float pitch, float yaw, CallbackInfoReturnable cir) { + public void revertCalculation(float pitch, float yaw, CallbackInfoReturnable cir) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) { cir.setReturnValue(Vec3d.fromPolar(pitch, yaw)); } @@ -112,8 +111,9 @@ public abstract class MixinEntity { int minZ = MathHelper.floor(box.minZ); int maxZ = MathHelper.ceil(box.maxZ); - if (!world.isRegionLoaded(minX, minY, minZ, maxX, maxY, maxZ)) + if (!world.isRegionLoaded(minX, minY, minZ, maxX, maxY, maxZ)) { ci.setReturnValue(false); + } double waterHeight = 0; boolean foundFluid = false; @@ -168,7 +168,6 @@ public abstract class MixinEntity { return constant; } - // Not relevant for GamePlay @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;onLanding()V")) public void revertOnLanding(Entity instance) { if (ProtocolHack.getTargetVersion().isNewerThanOrEqualTo(VersionEnum.r1_19)) {