Fixed X-Facing/Z-Facing in <= 1.13.2

This commit is contained in:
FlorianMichael 2024-02-09 19:44:21 +01:00
parent d8c2a036e9
commit 34c66e0f09
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -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();