修复音爆,替换部分引擎音效
This commit is contained in:
parent
7205d158cc
commit
48d29b3491
25 changed files with 105 additions and 156 deletions
|
@ -1,11 +1,12 @@
|
|||
package com.atsuishio.superbwarfare.client;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import org.joml.Math;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public abstract class VehicleSoundInstance extends AbstractTickableSoundInstance {
|
||||
private final Minecraft client;
|
||||
|
@ -27,8 +28,6 @@ public abstract class VehicleSoundInstance extends AbstractTickableSoundInstance
|
|||
protected abstract float getPitch(MobileVehicleEntity mobileVehicle);
|
||||
|
||||
protected abstract float getVolume(MobileVehicleEntity mobileVehicle);
|
||||
protected abstract float getRadius(MobileVehicleEntity mobileVehicle);
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
var player = this.client.player;
|
||||
|
@ -49,9 +48,7 @@ public abstract class VehicleSoundInstance extends AbstractTickableSoundInstance
|
|||
this.fade++;
|
||||
}
|
||||
|
||||
float distanceReduce = Math.max((1 - player.distanceTo(mobileVehicle) / getRadius(mobileVehicle)), 0);
|
||||
|
||||
this.volume = this.getVolume(this.mobileVehicle) * fade * distanceReduce * distanceReduce;
|
||||
this.volume = this.getVolume(this.mobileVehicle) * fade;
|
||||
|
||||
this.x = this.mobileVehicle.getX();
|
||||
this.y = this.mobileVehicle.getY();
|
||||
|
@ -69,11 +66,6 @@ public abstract class VehicleSoundInstance extends AbstractTickableSoundInstance
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attenuation getAttenuation() {
|
||||
return Attenuation.NONE;
|
||||
}
|
||||
|
||||
public static class EngineSound extends VehicleSoundInstance {
|
||||
public EngineSound(MobileVehicleEntity mobileVehicle, SoundEvent soundEvent) {
|
||||
super(soundEvent, Minecraft.getInstance(), mobileVehicle);
|
||||
|
@ -93,10 +85,26 @@ public abstract class VehicleSoundInstance extends AbstractTickableSoundInstance
|
|||
protected float getVolume(MobileVehicleEntity mobileVehicle) {
|
||||
return mobileVehicle.getEngineSoundVolume();
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrackSound extends VehicleSoundInstance {
|
||||
public TrackSound(MobileVehicleEntity mobileVehicle) {
|
||||
super(ModSounds.TRACK_MOVE.get(), Minecraft.getInstance(), mobileVehicle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getRadius(MobileVehicleEntity mobileVehicle) {
|
||||
return mobileVehicle.getEngineSoundRadius();
|
||||
protected boolean canPlay(MobileVehicleEntity mobileVehicle) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getPitch(MobileVehicleEntity mobileVehicle) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getVolume(MobileVehicleEntity mobileVehicle) {
|
||||
return (float) Mth.lerp(Mth.clamp(mobileVehicle.getDeltaMovement().length(), 0F, 0.3F), 0.0F, 0.3F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
|
||||
@Override
|
||||
protected void playStepSound(@NotNull BlockPos pPos, @NotNull BlockState pState) {
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.5), random.nextFloat() * 0.1f + 1f);
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.2), random.nextFloat() * 0.1f + 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,7 +132,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
super.baseTick();
|
||||
float f;
|
||||
|
||||
f = (float) Mth.clamp(Math.max((onGround() ? 0.785f : 0.79f) - 0.013 * getDeltaMovement().length(), 0.5) + 0.031f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
|
||||
f = (float) Mth.clamp(Math.max((onGround() ? 0.785f : 0.79f) - 0.01 * getDeltaMovement().length(), 0.5) + 0.031f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
|
||||
|
||||
boolean forward = Mth.abs((float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) < 90;
|
||||
|
||||
|
@ -311,11 +311,6 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
return ModSounds.A_10_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEngineSoundRadius() {
|
||||
return 192;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return entityData.get(POWER) * 1.5f;
|
||||
|
|
|
@ -362,14 +362,9 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
return ModSounds.HELICOPTER_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEngineSoundRadius() {
|
||||
return 192;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return entityData.get(PROPELLER_ROT) * 1.5f;
|
||||
return entityData.get(PROPELLER_ROT) * 2f;
|
||||
}
|
||||
|
||||
protected void clampRotation(Entity entity) {
|
||||
|
|
|
@ -6,10 +6,7 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
|||
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.SmallCannonShellWeapon;
|
||||
|
@ -70,7 +67,8 @@ import java.util.List;
|
|||
|
||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||
|
||||
public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||
public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
||||
|
||||
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> LOADED_MISSILE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> MISSILE_COUNT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
|
@ -186,7 +184,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
protected void playStepSound(BlockPos pPos, BlockState pState) {
|
||||
this.playSound(ModSounds.BMP_STEP.get(), Mth.abs(this.entityData.get(POWER)) * 8, random.nextFloat() * 0.15f + 1f);
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.15), random.nextFloat() * 0.15f + 1.05f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -501,6 +499,11 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
return ModSounds.BMP_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return Math.max(Mth.abs(entityData.get(POWER)), Mth.abs(0.1f * this.entityData.get(DELTA_ROT))) * 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
|
||||
// From Immersive_Aircraft
|
||||
|
|
|
@ -121,7 +121,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
protected void playStepSound(BlockPos pPos, BlockState pState) {
|
||||
this.playSound(ModSounds.BMP_STEP.get(), Mth.abs(this.entityData.get(POWER)) * 3, random.nextFloat() * 0.15f + 1.05f);
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.3), random.nextFloat() * 0.15f + 1.05f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -385,6 +385,11 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
return ModSounds.LAV_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return Mth.abs(entityData.get(POWER)) * 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
|
||||
// From Immersive_Aircraft
|
||||
|
|
|
@ -5,10 +5,7 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
|||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||
|
@ -73,7 +70,7 @@ import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
|||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||
import static com.atsuishio.superbwarfare.tools.SeekTool.baseFilter;
|
||||
|
||||
public class PrismTankEntity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||
public class PrismTankEntity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
||||
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.INT);
|
||||
|
||||
public static final EntityDataAccessor<Float> LASER_LENGTH = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.FLOAT);
|
||||
|
@ -164,7 +161,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
|
||||
@Override
|
||||
protected void playStepSound(@NotNull BlockPos pPos, @NotNull BlockState pState) {
|
||||
this.playSound(ModSounds.BMP_STEP.get(), Mth.abs(this.entityData.get(POWER)) * 8, random.nextFloat() * 0.15f + 1f);
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.15), random.nextFloat() * 0.15f + 1.05f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -545,7 +542,12 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
|
||||
@Override
|
||||
public SoundEvent getEngineSound() {
|
||||
return ModSounds.BMP_ENGINE.get();
|
||||
return ModSounds.PRISM_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return Math.max(Mth.abs(entityData.get(POWER)), Mth.abs(0.1f * this.entityData.get(DELTA_ROT))) * 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -237,11 +237,6 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
return SoundEvents.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEngineSoundRadius() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return entityData.get(POWER);
|
||||
|
|
|
@ -4,10 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
|
|||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||
|
@ -76,7 +73,7 @@ import java.util.List;
|
|||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||
|
||||
public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||
public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
||||
public static final EntityDataAccessor<Integer> MG_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> LOADED_AP = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> LOADED_HE = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||
|
@ -261,7 +258,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
|
||||
@Override
|
||||
protected void playStepSound(@NotNull BlockPos pPos, @NotNull BlockState pState) {
|
||||
this.playSound(ModSounds.BMP_STEP.get(), Mth.abs(this.entityData.get(POWER)) * 8, random.nextFloat() * 0.15f + 1f);
|
||||
this.playSound(ModSounds.WHEEL_STEP.get(), (float) (getDeltaMovement().length() * 0.15), random.nextFloat() * 0.15f + 1.05f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -781,7 +778,12 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
|
||||
@Override
|
||||
public SoundEvent getEngineSound() {
|
||||
return ModSounds.BMP_ENGINE.get();
|
||||
return ModSounds.YX_100_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEngineSoundVolume() {
|
||||
return Math.max(Mth.abs(entityData.get(POWER)), Mth.abs(0.1f * this.entityData.get(DELTA_ROT))) * 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||
|
||||
public interface TrackEntity {
|
||||
}
|
|
@ -2,8 +2,9 @@ package com.atsuishio.superbwarfare.event;
|
|||
|
||||
import com.atsuishio.superbwarfare.client.VehicleSoundInstance;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.SwarmDroneEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.TrackEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
|
@ -12,7 +13,6 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -25,20 +25,18 @@ import org.joml.Math;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity.DELTA_ROT;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.POWER;
|
||||
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
||||
public class ClientSoundHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleJoinLevelEvent(EntityJoinLevelEvent event) {
|
||||
if (event.getLevel().isClientSide) {
|
||||
com.atsuishio.superbwarfare.Mod.queueClientWork(5, () -> {
|
||||
if (event.getEntity() instanceof MobileVehicleEntity mobileVehicle) {
|
||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
|
||||
}
|
||||
});
|
||||
if (event.getEntity() instanceof MobileVehicleEntity mobileVehicle) {
|
||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
|
||||
}
|
||||
if (event.getEntity() instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof TrackEntity) {
|
||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,46 +58,7 @@ public class ClientSoundHandler {
|
|||
var engineSoundPos = new Vec3(listener.x + toVec.x, listener.y + toVec.y, listener.z + toVec.z);
|
||||
SoundEvent engineSound = mobileVehicle.getEngineSound();
|
||||
float distanceReduce;
|
||||
// if (e instanceof Ah6Entity ah6Entity) {
|
||||
// distanceReduce = (float) Math.max((1 - distance / 128), 0);
|
||||
// if (player.getVehicle() == ah6Entity) {
|
||||
// player.playSound(ModSounds.HELICOPTER_ENGINE_1P.get(), 2 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f), (float) ((2 * Math.random() - 1) * 0.1f + 1.0f));
|
||||
// } else {
|
||||
// player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
// }
|
||||
// }
|
||||
if (e instanceof Lav150Entity lav150) {
|
||||
distanceReduce = (float) Math.max((1 - distance / 64), 0);
|
||||
if (player.getVehicle() == lav150) {
|
||||
player.playSound(ModSounds.LAV_ENGINE_1P.get(), 1 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) - 0.006f), (float) ((2 * Math.random() - 1) * 0.1f + 0.95f));
|
||||
} else {
|
||||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) - 0.006f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
}
|
||||
}
|
||||
if (e instanceof Bmp2Entity bmp2) {
|
||||
distanceReduce = (float) Math.max((1 - distance / 64), 0);
|
||||
if (player.getVehicle() == bmp2) {
|
||||
player.playSound(ModSounds.BMP_ENGINE_1P.get(), 1 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f), (float) ((2 * Math.random() - 1) * 0.1f + 0.95f));
|
||||
} else {
|
||||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
}
|
||||
}
|
||||
if (e instanceof Yx100Entity yx100) {
|
||||
distanceReduce = (float) Math.max((1 - distance / 64), 0);
|
||||
if (player.getVehicle() == yx100) {
|
||||
player.playSound(ModSounds.BMP_ENGINE_1P.get(), 1 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f), (float) ((2 * Math.random() - 1) * 0.1f + 0.95f));
|
||||
} else {
|
||||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
}
|
||||
}
|
||||
if (e instanceof PrismTankEntity prismTank) {
|
||||
distanceReduce = (float) Math.max((1 - distance / 64), 0);
|
||||
if (player.getVehicle() == prismTank) {
|
||||
player.playSound(ModSounds.BMP_ENGINE_1P.get(), 1 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f), (float) ((2 * Math.random() - 1) * 0.1f + 0.95f));
|
||||
} else {
|
||||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof DroneEntity) {
|
||||
distanceReduce = (float) Math.max((1 - distance / 64), 0);
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
@ -110,14 +69,6 @@ public class ClientSoundHandler {
|
|||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), e.onGround() ? 0 : distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.002f + 1.05), false);
|
||||
}
|
||||
}
|
||||
// if (e instanceof A10Entity a10Entity) {
|
||||
// distanceReduce = (float) Math.max((1 - distance / 128), 0);
|
||||
// if (player.getVehicle() == a10Entity) {
|
||||
// player.playSound(ModSounds.A_10_ENGINE_1P.get(), 2 * (mobileVehicle.getEntityData().get(POWER) - 0.012f), (float) ((2 * Math.random() - 1) * 0.1f + 1.0f));
|
||||
// } else {
|
||||
// player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(POWER) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -384,7 +384,6 @@ public class ModSounds {
|
|||
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_ENGINE_START = REGISTRY.register("helicopter_engine_start", () -> SoundEvent.createVariableRangeEvent(Mod.loc("helicopter_engine_start")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_ENGINE = REGISTRY.register("helicopter_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("helicopter_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_ENGINE_1P = REGISTRY.register("helicopter_engine_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("helicopter_engine_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_CANNON_FIRE_1P = REGISTRY.register("heli_cannon_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("heli_cannon_fire_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_CANNON_FIRE_3P = REGISTRY.register("heli_cannon_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("heli_cannon_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HELICOPTER_CANNON_FAR = REGISTRY.register("heli_cannon_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("heli_cannon_far")));
|
||||
|
@ -407,16 +406,13 @@ public class ModSounds {
|
|||
public static final DeferredHolder<SoundEvent, SoundEvent> LAV_CANNON_FAR = REGISTRY.register("lav_cannon_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("lav_far")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LAV_CANNON_VERYFAR = REGISTRY.register("lav_cannon_veryfar", () -> SoundEvent.createVariableRangeEvent(Mod.loc("lav_veryfar")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LAV_ENGINE = REGISTRY.register("lav_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("lav_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LAV_ENGINE_1P = REGISTRY.register("lav_engine_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("lav_engine_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> COAX_FIRE_1P = REGISTRY.register("coax_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("coax_fire_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_CANNON_FIRE_1P = REGISTRY.register("bmp_cannon_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_fire_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_CANNON_FIRE_3P = REGISTRY.register("bmp_cannon_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_ENGINE = REGISTRY.register("bmp_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_ENGINE_1P = REGISTRY.register("bmp_engine_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_engine_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_MISSILE_FIRE_1P = REGISTRY.register("bmp_missile_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_missile_fire_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_MISSILE_FIRE_3P = REGISTRY.register("bmp_missile_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_missile_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_MISSILE_RELOAD = REGISTRY.register("bmp_missile_reload", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_missile_reload")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> BMP_STEP = REGISTRY.register("bmp_step", () -> SoundEvent.createVariableRangeEvent(Mod.loc("bmp_step")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WHEEL_STEP = REGISTRY.register("wheel_step", () -> SoundEvent.createVariableRangeEvent(Mod.loc("wheel_step")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> LASER_TOWER_SHOOT = REGISTRY.register("laser_tower_shoot", () -> SoundEvent.createVariableRangeEvent(Mod.loc("laser_tower_shoot")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> YX_100_RELOAD = REGISTRY.register("yx_100_reload", () -> SoundEvent.createVariableRangeEvent(Mod.loc("yx_100_reload")));
|
||||
|
@ -424,6 +420,7 @@ public class ModSounds {
|
|||
public static final DeferredHolder<SoundEvent, SoundEvent> YX_100_FIRE_3P = REGISTRY.register("yx_100_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("yx_100_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> YX_100_FAR = REGISTRY.register("yx_100_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("yx_100_far")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> YX_100_VERYFAR = REGISTRY.register("yx_100_veryfar", () -> SoundEvent.createVariableRangeEvent(Mod.loc("yx_100_veryfar")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> YX_100_ENGINE = REGISTRY.register("yx_100_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("yx_100_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TURRET_TURN = REGISTRY.register("turret_turn", () -> SoundEvent.createVariableRangeEvent(Mod.loc("turret_turn")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> C4_BEEP = REGISTRY.register("c4_beep", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_beep")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> C4_FINAL = REGISTRY.register("c4_final", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_final")));
|
||||
|
@ -433,6 +430,7 @@ public class ModSounds {
|
|||
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_3P = REGISTRY.register("prism_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_1P_2 = REGISTRY.register("prism_fire_1p_2", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_1p_2")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_3P_2 = REGISTRY.register("prism_fire_3p_2", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_3p_2")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_ENGINE = REGISTRY.register("prism_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> INSIDIOUS_FIRE_1P = REGISTRY.register("insidious_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("insidious_fire_1p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> INSIDIOUS_FIRE_3P = REGISTRY.register("insidious_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("insidious_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> INSIDIOUS_FAR = REGISTRY.register("insidious_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("insidious_far")));
|
||||
|
@ -442,8 +440,7 @@ public class ModSounds {
|
|||
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_FIRE_3P = REGISTRY.register("hpj_11_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_fire_3p")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_FAR = REGISTRY.register("hpj_11_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_far")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_VERYFAR = REGISTRY.register("hpj_11_veryfar", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_veryfar")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> WIND_LOOP = REGISTRY.register("wind_loop", () -> SoundEvent.createVariableRangeEvent(Mod.loc("wind_loop")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> TRACK_MOVE = REGISTRY.register("track_move", () -> SoundEvent.createVariableRangeEvent(Mod.loc("track_move")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> A_10_ENGINE = REGISTRY.register("a10_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("a10_engine")));
|
||||
public static final DeferredHolder<SoundEvent, SoundEvent> A_10_ENGINE_1P = REGISTRY.register("a10_engine_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("a10_engine_1p")));
|
||||
}
|
||||
|
||||
|
|
|
@ -2474,8 +2474,8 @@
|
|||
"wheel_chair_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:wheel_chair/wheel_chair_engine",
|
||||
"stream": false
|
||||
"stream": true,
|
||||
"name": "superbwarfare:wheel_chair/wheel_chair_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -2518,17 +2518,12 @@
|
|||
"helicopter_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 160,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:helicopter/heli_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"helicopter_engine_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:helicopter/heli_engine_1p"
|
||||
}
|
||||
]
|
||||
},
|
||||
"heli_cannon_fire_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -2788,17 +2783,12 @@
|
|||
"lav_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 64,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:lav/lav_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lav_engine_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:lav/lav_engine_1p"
|
||||
}
|
||||
]
|
||||
},
|
||||
"coax_fire_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -2825,17 +2815,12 @@
|
|||
"bmp_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 64,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:bmp/bmp_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"bmp_engine_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:bmp/bmp_engine_1p"
|
||||
}
|
||||
]
|
||||
},
|
||||
"bmp_missile_fire_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -2860,14 +2845,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"bmp_step": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:bmp/bmp_step",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"wheel_step": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -2924,6 +2901,15 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"yx_100_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 64,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:yx100/yx100_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"turret_turn": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -2996,6 +2982,15 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"prism_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 64,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:prism/prism_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"insidious_fire_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
|
@ -3068,25 +3063,22 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"wind_loop": {
|
||||
"track_move": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:wind_loop"
|
||||
"attenuation_distance": 32,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:track_move"
|
||||
}
|
||||
]
|
||||
},
|
||||
"a10_engine": {
|
||||
"sounds": [
|
||||
{
|
||||
"attenuation_distance": 160,
|
||||
"stream": true,
|
||||
"name": "superbwarfare:a10/a10_engine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"a10_engine_1p": {
|
||||
"sounds": [
|
||||
{
|
||||
"name": "superbwarfare:a10/a10_engine_1p"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/main/resources/assets/superbwarfare/sounds/track_move.ogg
Normal file
BIN
src/main/resources/assets/superbwarfare/sounds/track_move.ogg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue