mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-08 19:38:57 +01:00
Cleaned up x-z collision fix
This commit is contained in:
parent
34c66e0f09
commit
787ce37bed
@ -19,7 +19,6 @@
|
||||
|
||||
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;
|
||||
@ -48,8 +47,6 @@ 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 {
|
||||
@ -146,6 +143,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) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_13_2)) {
|
||||
return Double.MAX_VALUE;
|
||||
} else {
|
||||
return Math.abs(a);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getRotationVector(FF)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true)
|
||||
private void revertCalculation(float pitch, float yaw, CallbackInfoReturnable<Vec3d> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
|
||||
@ -219,15 +225,6 @@ 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();
|
||||
|
Loading…
Reference in New Issue
Block a user