优化部分代码

This commit is contained in:
17146 2025-05-13 14:04:51 +08:00 committed by Light_Quanta
parent 8766a69a7a
commit 75ca155776
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -198,8 +198,7 @@ public class GunEventHandler {
String origin = stack.getItem().getDescriptionId(); String origin = stack.getItem().getDescriptionId();
String name = origin.substring(origin.lastIndexOf(".") + 1); String name = origin.substring(origin.lastIndexOf(".") + 1);
SoundEvent sound1p; SoundEvent sound1p = BuiltInRegistries.SOUND_EVENT.get(Mod.loc(name + "_reload_normal"));
sound1p = BuiltInRegistries.SOUND_EVENT.get(Mod.loc(name + "_reload_normal"));
if (sound1p != null && player instanceof ServerPlayer serverPlayer) { if (sound1p != null && player instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, sound1p, 10f, 1f); SoundTool.playLocalSound(serverPlayer, sound1p, 10f, 1f);
@ -220,13 +219,6 @@ public class GunEventHandler {
reload.iterativeLoadTimer.reduce(); reload.iterativeLoadTimer.reduce();
reload.finishTimer.reduce(); reload.finishTimer.reduce();
// player.displayClientMessage(Component.literal("prepare: " + new DecimalFormat("##.#").format(data.reload.prepareTimer.get())
// + " prepare_load: " + new DecimalFormat("##.#").format(data.reload.iterativeLoadTimer.get())
// + " iterative: " + new DecimalFormat("##.#").format(tag.getDouble("IterativeLoadTime"))
// + " finish: " + new DecimalFormat("##.#").format(tag.getDouble("FinishTime"))
// + " reload_stage: " + new DecimalFormat("##.#").format(tag.getDouble("reload_stage"))
// ), true);
// 一阶段 // 一阶段
if (reload.singleReloadStarter.start()) { if (reload.singleReloadStarter.start()) {
NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, data)); NeoForge.EVENT_BUS.post(new ReloadEvent.Pre(player, data));