修改音效方法

This commit is contained in:
17146 2025-05-12 14:42:26 +08:00
parent dd6d50fc6e
commit 57d7504784

View file

@ -80,24 +80,26 @@ public abstract class ClientPacketListenerMixin {
@Inject(method = "postAddEntitySoundInstance(Lnet/minecraft/world/entity/Entity;)V", at = @At("RETURN")) @Inject(method = "postAddEntitySoundInstance(Lnet/minecraft/world/entity/Entity;)V", at = @At("RETURN"))
private void postAddEntitySoundInstance(Entity pEntity, CallbackInfo ci) { private void postAddEntitySoundInstance(Entity pEntity, CallbackInfo ci) {
Mod.queueClientWork(60, () -> { if (pEntity instanceof LoudlyEntity) {
if (pEntity instanceof MobileVehicleEntity mobileVehicle) { Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(pEntity));
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound())); Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(pEntity));
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle)); } else {
} Mod.queueClientWork(30, () -> {
if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof TrackEntity) { if (pEntity instanceof MobileVehicleEntity mobileVehicle) {
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle)); if (mobileVehicle instanceof TrackEntity) {
} Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle));
if (pEntity instanceof LoudlyEntity) { }
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(pEntity)); if (mobileVehicle instanceof A10Entity) {
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(pEntity)); Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle));
} }
if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof A10Entity) { if (mobileVehicle instanceof Hpj11Entity) {
Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle)); Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle));
} }
if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof Hpj11Entity) {
Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle)); Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
} Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle));
}); }
});
}
} }
} }