From 57d750478465f58ee04cb88a7970923d9cd7186c Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Mon, 12 May 2025 14:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9F=B3=E6=95=88=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mixins/ClientPacketListenerMixin.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java index 7d864a650..1a3141601 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/ClientPacketListenerMixin.java @@ -80,24 +80,26 @@ public abstract class ClientPacketListenerMixin { @Inject(method = "postAddEntitySoundInstance(Lnet/minecraft/world/entity/Entity;)V", at = @At("RETURN")) private void postAddEntitySoundInstance(Entity pEntity, CallbackInfo ci) { - Mod.queueClientWork(60, () -> { - if (pEntity instanceof MobileVehicleEntity mobileVehicle) { - Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound())); - Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle)); - } - if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof TrackEntity) { - Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle)); - } - if (pEntity instanceof LoudlyEntity) { - Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(pEntity)); - Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(pEntity)); - } - if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof A10Entity) { - Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle)); - } - if (pEntity instanceof MobileVehicleEntity mobileVehicle && mobileVehicle instanceof Hpj11Entity) { - Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle)); - } - }); + if (pEntity instanceof LoudlyEntity) { + Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(pEntity)); + Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(pEntity)); + } else { + Mod.queueClientWork(30, () -> { + if (pEntity instanceof MobileVehicleEntity mobileVehicle) { + if (mobileVehicle instanceof TrackEntity) { + Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle)); + } + if (mobileVehicle instanceof A10Entity) { + Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle)); + } + if (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)); + } + }); + } } }