From 34c66e0f099fb73064766cf820aa6cad2cde6bad Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:44:21 +0100 Subject: [PATCH] Fixed X-Facing/Z-Facing in <= 1.13.2 --- .../mixin/fixes/minecraft/entity/MixinEntity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 9ff69815..ccb8796d 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 @@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity; +import com.llamalad7.mixinextras.sugar.Local; import de.florianmichael.viafabricplus.fixes.versioned.visual.EntityRidingOffsetsPre1_20_2; import de.florianmichael.viafabricplus.injection.access.IEntity; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; @@ -47,6 +48,8 @@ import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.List; + @SuppressWarnings("ConstantValue") @Mixin(Entity.class) public abstract class MixinEntity implements IEntity { @@ -216,6 +219,15 @@ public abstract class MixinEntity implements IEntity { } } + @Redirect(method = "adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;Ljava/util/List;)Lnet/minecraft/util/math/Vec3d;", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(D)D", ordinal = 0)) + private static double alwaysSortYXZ(double a, @Local(argsOnly = true) Vec3d movement) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) { + return Double.MAX_VALUE; + } else { + return Math.abs(a); + } + } + @Override public boolean viaFabricPlus$isInLoadedChunkAndShouldTick() { return this.viaFabricPlus$isInLoadedChunkAndShouldTick || DebugSettings.global().alwaysTickClientPlayer.isEnabled();