优化炮塔旋转音效播放条件

This commit is contained in:
Atsuihsio 2025-03-09 20:24:59 +08:00
parent 9e16d0faf5
commit 7e4f5eaf9c

View file

@ -215,7 +215,7 @@ public abstract class VehicleEntity extends Entity {
} }
public void turretTurnSound(float diffX, float diffY, float pitch) { public void turretTurnSound(float diffX, float diffY, float pitch) {
if (level().isClientSide && java.lang.Math.max(Mth.abs(diffX), Mth.abs(diffY)) > 0) { if (level().isClientSide && (java.lang.Math.abs(diffY) > 0.5 || java.lang.Math.abs(diffX) > 0.5)) {
level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), ModSounds.TURRET_TURN.get(), this.getSoundSource(), (float) java.lang.Math.min(0.15 * (java.lang.Math.max(Mth.abs(diffX), Mth.abs(diffY))), 0.75), (random.nextFloat() * 0.05f + pitch), false); level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), ModSounds.TURRET_TURN.get(), this.getSoundSource(), (float) java.lang.Math.min(0.15 * (java.lang.Math.max(Mth.abs(diffX), Mth.abs(diffY))), 0.75), (random.nextFloat() * 0.05f + pitch), false);
} }
} }