diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java index 969c96f15..57ec5fd2f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java @@ -491,7 +491,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, float diffY = Mth.wrapDegrees(entityData.get(YAW) - this.getYRot()); float diffX = Mth.wrapDegrees(entityData.get(PITCH) - this.getXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.8f); this.setYRot(this.getYRot() + Mth.clamp(0.5f * diffY, -0.6f, 0.6f)); this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(diffX, -2f, 2f), -45, 5f)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index 3527c2f57..83770dba6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -509,7 +509,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.05f); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setTurretXRot(Mth.clamp(this.getTurretXRot() + Mth.clamp(0.95f * diffX, -5, 5), -74f, 7.5f)); this.setTurretYRot(this.getTurretYRot() + Mth.clamp(0.95f * diffY, -15, 15)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java index 6a5f563f0..281eb0a3f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java @@ -288,6 +288,8 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity, float diffY = Math.clamp(-90f, 90f, Mth.wrapDegrees(targetY - this.getYRot())); + turretTurnSound(0, diffY, 1.1f); + this.setYRot(this.getYRot() + Mth.clamp(0.5f * diffY, -60f, 60f)); this.setRot(this.getYRot(), this.getXRot()); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index dc7ae0062..479eca07b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -453,7 +453,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.05f); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setTurretXRot(Mth.clamp(this.getTurretXRot() + Mth.clamp(0.95f * diffX, -5, 5), -32.5f, 15)); this.setTurretYRot(this.getTurretYRot() + Mth.clamp(0.95f * diffY, -20, 20)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index a6b362988..42f3faa56 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -339,7 +339,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity float diffY = Mth.wrapDegrees(entityData.get(YAW) - this.getYRot()); float diffX = Mth.wrapDegrees(entityData.get(PITCH) - this.getXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setYRot(this.getYRot() + Mth.clamp(0.5f * diffY, -1.75f, 1.75f)); this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(0.5f * diffX, -3f, 3f), -85, 16.3f)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index e8b75dd47..f8776ed31 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -434,7 +434,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt float diffY = Mth.wrapDegrees(entityData.get(YAW) - this.getYRot()); float diffX = Mth.wrapDegrees(entityData.get(PITCH) - this.getXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setYRot(this.getYRot() + Mth.clamp(0.5f * diffY, -1.25f, 1.25f)); this.setXRot(Mth.clamp(this.getXRot() + Mth.clamp(0.5f * diffX, -2f, 2f), -30, 4f)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java index 619b3daa4..36fdc5665 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java @@ -357,7 +357,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.05f); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setTurretXRot(this.getTurretXRot() + Mth.clamp(0.95f * diffX, -40, 40)); this.setTurretYRot(Mth.clamp(this.getTurretYRot() + Mth.clamp(0.95f * diffY, -40, 40), -140, 140)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index 2dffc7099..cc6d702ac 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -589,7 +589,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti diffY = Mth.wrapDegrees(turretAngle - getTurretYRot() + 0.05f); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); float min = -5 + (float) (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT); float max = 5 + (float) (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT); @@ -610,7 +610,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti diffY = Mth.wrapDegrees(gunAngle - getGunYRot()); diffX = Mth.wrapDegrees(gunner.getXRot() - this.getGunXRot()); - turretTurnSound(diffX, diffY); + turretTurnSound(diffX, diffY, 0.95f); this.setGunXRot(Mth.clamp(this.getGunXRot() + Mth.clamp(0.95f * diffX, -10, 10), -60f, 12.5f)); this.setGunYRot(this.getGunYRot() + Mth.clamp(0.9f * diffY, -15, 15)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java index 8e799e10f..43d3d3621 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java @@ -214,9 +214,9 @@ public abstract class VehicleEntity extends Entity { roll = rot; } - public void turretTurnSound(float diffX, float diffY) { + public void turretTurnSound(float diffX, float diffY, float pitch) { if (level().isClientSide && java.lang.Math.max(Mth.abs(diffX), Mth.abs(diffY)) > 0) { - 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 + 0.95f), 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); } }