尝试调整音效系统
This commit is contained in:
parent
1cf17468c3
commit
b3f8e7d671
7 changed files with 49 additions and 33 deletions
|
@ -3,14 +3,17 @@ package com.atsuishio.superbwarfare;
|
||||||
import com.atsuishio.superbwarfare.api.event.RegisterContainersEvent;
|
import com.atsuishio.superbwarfare.api.event.RegisterContainersEvent;
|
||||||
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
||||||
import com.atsuishio.superbwarfare.client.renderer.molang.MolangVariable;
|
import com.atsuishio.superbwarfare.client.renderer.molang.MolangVariable;
|
||||||
|
import com.atsuishio.superbwarfare.client.sound.VehicleSoundInstance;
|
||||||
import com.atsuishio.superbwarfare.compat.CompatHolder;
|
import com.atsuishio.superbwarfare.compat.CompatHolder;
|
||||||
import com.atsuishio.superbwarfare.compat.clothconfig.ClothConfigHelper;
|
import com.atsuishio.superbwarfare.compat.clothconfig.ClothConfigHelper;
|
||||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||||
import com.atsuishio.superbwarfare.config.ClientConfig;
|
import com.atsuishio.superbwarfare.config.ClientConfig;
|
||||||
import com.atsuishio.superbwarfare.config.CommonConfig;
|
import com.atsuishio.superbwarfare.config.CommonConfig;
|
||||||
import com.atsuishio.superbwarfare.config.ServerConfig;
|
import com.atsuishio.superbwarfare.config.ServerConfig;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.NetworkRegistry;
|
import com.atsuishio.superbwarfare.network.NetworkRegistry;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
|
@ -122,6 +125,9 @@ public class Mod {
|
||||||
public void onClientSetup(final FMLClientSetupEvent event) {
|
public void onClientSetup(final FMLClientSetupEvent event) {
|
||||||
MouseMovementHandler.init();
|
MouseMovementHandler.init();
|
||||||
MolangVariable.register();
|
MolangVariable.register();
|
||||||
|
|
||||||
|
MobileVehicleEntity.trackSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(vehicle));
|
||||||
|
MobileVehicleEntity.engineSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(vehicle, vehicle.getEngineSound()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.client.sound;
|
package com.atsuishio.superbwarfare.client.sound;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.Mod;
|
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Hpj11Entity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.TrackEntity;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
@ -19,21 +14,21 @@ public class ClientSoundHandler {
|
||||||
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(entity));
|
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(entity));
|
||||||
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(entity));
|
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(entity));
|
||||||
} else {
|
} else {
|
||||||
Mod.queueClientWork(60, () -> {
|
// Mod.queueClientWork(60, () -> {
|
||||||
if (entity instanceof MobileVehicleEntity mobileVehicle) {
|
// if (entity instanceof MobileVehicleEntity mobileVehicle) {
|
||||||
if (mobileVehicle instanceof TrackEntity) {
|
// if (mobileVehicle instanceof TrackEntity) {
|
||||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle));
|
// Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle));
|
||||||
}
|
// }
|
||||||
if (mobileVehicle instanceof A10Entity) {
|
// if (mobileVehicle instanceof A10Entity) {
|
||||||
Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle));
|
// Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle));
|
||||||
}
|
// }
|
||||||
if (mobileVehicle instanceof Hpj11Entity) {
|
// if (mobileVehicle instanceof Hpj11Entity) {
|
||||||
Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle));
|
// Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle));
|
||||||
}
|
// }
|
||||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
|
// Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
|
||||||
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle));
|
// Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle));
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,10 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
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.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.SmallCannonShellWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.SmallCannonShellWeapon;
|
||||||
|
@ -65,7 +68,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
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> LOADED_MISSILE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
|
@ -189,14 +192,18 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
this.handleAmmo();
|
this.handleAmmo();
|
||||||
}
|
}
|
||||||
|
|
||||||
double fluidFloat;
|
double fluidFloat = 0.052 * getSubmergedHeight(this);
|
||||||
fluidFloat = 0.052 * getSubmergedHeight(this);
|
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0));
|
this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0));
|
||||||
|
|
||||||
if (this.onGround()) {
|
if (this.onGround()) {
|
||||||
float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
|
float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * getDeltaMovement().dot(getViewVector(1)))));
|
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * getDeltaMovement().dot(getViewVector(1)))));
|
||||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.99, f0));
|
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.99, f0));
|
||||||
|
|
||||||
|
// TODO 替换成正确的履带音效播放条件
|
||||||
|
if (this.level().isClientSide) {
|
||||||
|
trackSound.accept(this);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, 0.99));
|
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, 0.99));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,10 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
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.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
|
@ -68,7 +71,8 @@ import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
import static com.atsuishio.superbwarfare.tools.SeekTool.baseFilter;
|
import static com.atsuishio.superbwarfare.tools.SeekTool.baseFilter;
|
||||||
|
|
||||||
public class PrismTankEntity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
// TODO 添加正确的履带音效播放条件
|
||||||
|
public class PrismTankEntity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.INT);
|
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);
|
public static final EntityDataAccessor<Float> LASER_LENGTH = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -5,7 +5,10 @@ import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.AerialBombEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SwarmDroneEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.SwarmDroneEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.*;
|
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.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
|
@ -74,7 +77,9 @@ import java.util.List;
|
||||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity, TrackEntity {
|
// TODO 添加正确的履带音效播放条件
|
||||||
|
public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> MG_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
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_AP = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> LOADED_HE = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> LOADED_HE = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||||
|
|
|
@ -51,8 +51,11 @@ import java.util.function.Consumer;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements ControllableVehicle {
|
public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements ControllableVehicle {
|
||||||
public static Consumer<MobileVehicleEntity> engineSound = e -> {
|
public static Consumer<MobileVehicleEntity> trackSound = vehicle -> {
|
||||||
};
|
};
|
||||||
|
public static Consumer<MobileVehicleEntity> engineSound = vehicle -> {
|
||||||
|
};
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> CANNON_RECOIL_TIME = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> CANNON_RECOIL_TIME = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.INT);
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> POWER = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> POWER = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
|
||||||
|
|
||||||
public interface TrackEntity {
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue