mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-21 11:46:49 +01:00
Slightly change body rotation interpolation in <= 1.19.3 (#542)
* Add Old Body Rotation Interpolation <=1.19.3 * Rename method as requested Co-authored-by: EnZaXD <florian.michael07@gmail.com> * Add comment as requested Co-authored-by: EnZaXD <florian.michael07@gmail.com> --------- Co-authored-by: lowercasebtw <lowercasebtw@gmail.com> Co-authored-by: EnZaXD <florian.michael07@gmail.com>
This commit is contained in:
parent
ef174f8c14
commit
b7d152c1cd
@ -74,6 +74,8 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
@Shadow
|
||||
public abstract boolean hasStatusEffect(RegistryEntry<StatusEffect> effect);
|
||||
|
||||
@Shadow public float bodyYaw;
|
||||
|
||||
public MixinLivingEntity(EntityType<?> type, World world) {
|
||||
super(type, world);
|
||||
}
|
||||
@ -112,6 +114,20 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "turnHead", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(F)F"))
|
||||
private float changeBodyRotationInterpolation(float g) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
|
||||
g = MathHelper.clamp(g, -75.0F, 75.0F);
|
||||
this.bodyYaw = this.getYaw() - g;
|
||||
if (Math.abs(g) > 50.0F) {
|
||||
this.bodyYaw += g * 0.2F;
|
||||
}
|
||||
return Float.MIN_VALUE; // Causes the if to always fail
|
||||
} else {
|
||||
return Math.abs(g);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickCramming", at = @At("HEAD"), cancellable = true)
|
||||
private void preventEntityPush(CallbackInfo ci) {
|
||||
if (DebugSettings.global().preventEntityCramming.isEnabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user