From f77d418978f7055e638f417a54857f91d24bdafb Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Mon, 15 Jul 2024 23:57:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=93=A8=E5=85=B5=E7=9A=84?= =?UTF-8?q?=E9=9F=B3=E6=95=88=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../target/event/GunEventHandler.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/mcreator/target/event/GunEventHandler.java b/src/main/java/net/mcreator/target/event/GunEventHandler.java index 7662785a1..1f60f15ae 100644 --- a/src/main/java/net/mcreator/target/event/GunEventHandler.java +++ b/src/main/java/net/mcreator/target/event/GunEventHandler.java @@ -296,28 +296,29 @@ public class GunEventHandler { if (soundVeryFar != null) { player.playSound(soundVeryFar, 24f, 1f); } - } - } else { - SoundEvent sound1p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_fire_1p")); - if (sound1p != null && player instanceof ServerPlayer serverPlayer) { - SoundTool.playLocalSound(serverPlayer, sound1p, 2f, 1f); - } - SoundEvent sound3p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_fire_3p")); - if (sound3p != null) { - player.level().playSound(null, player.getOnPos(), sound3p, SoundSource.PLAYERS, 4f, 1f); + return; } + } - SoundEvent soundFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_far")); - if (soundFar != null) { - player.playSound(soundFar, 12f, 1f); - } + SoundEvent sound1p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_fire_1p")); + if (sound1p != null && player instanceof ServerPlayer serverPlayer) { + SoundTool.playLocalSound(serverPlayer, sound1p, 2f, 1f); + } - SoundEvent soundVeryFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_veryfar")); - if (soundVeryFar != null) { - player.playSound(soundVeryFar, 24f, 1f); - } + SoundEvent sound3p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_fire_3p")); + if (sound3p != null) { + player.level().playSound(null, player.getOnPos(), sound3p, SoundSource.PLAYERS, 4f, 1f); + } + SoundEvent soundFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_far")); + if (soundFar != null) { + player.playSound(soundFar, 12f, 1f); + } + + SoundEvent soundVeryFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(TargetMod.MODID, name + "_veryfar")); + if (soundVeryFar != null) { + player.playSound(soundVeryFar, 24f, 1f); } } }