From c8a1627fd4bb8a3aa6ed6dc00ed703b683cf395a Mon Sep 17 00:00:00 2001 From: Emanuel Ferraz Date: Mon, 11 Dec 2023 00:28:07 +0000 Subject: [PATCH] fix: sound events crashing servers on release builds --- build.properties | 2 +- .../common/core/handler/PsiSoundHandler.java | 28 ++++++------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/build.properties b/build.properties index 490f12b7..7ad10112 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ mapping_channel=parchment mod_id=psi forge_version=43.3.0 jei_version=11.6.0.1013 -build_number=99 +build_number=100 patchy_version=1.19.2-77 dir_output=../Build Output/Psi/ version=1.19 diff --git a/src/main/java/vazkii/psi/common/core/handler/PsiSoundHandler.java b/src/main/java/vazkii/psi/common/core/handler/PsiSoundHandler.java index f7f69b77..58f3f7d2 100644 --- a/src/main/java/vazkii/psi/common/core/handler/PsiSoundHandler.java +++ b/src/main/java/vazkii/psi/common/core/handler/PsiSoundHandler.java @@ -20,29 +20,19 @@ @Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public final class PsiSoundHandler { - public static SoundEvent bulletCreate; - public static SoundEvent cadCreate; - public static SoundEvent cadShoot; - public static SoundEvent compileError; - public static SoundEvent levelUp; - public static SoundEvent loopcast; - public static SoundEvent book; - public static SoundEvent bookOpen; - public static SoundEvent bookFlip; + public static final SoundEvent bulletCreate = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "bullet_create")); + public static final SoundEvent cadCreate = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "cad_create")); + public static final SoundEvent cadShoot = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "cad_shoot")); + public static final SoundEvent compileError = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "compile_error")); + public static final SoundEvent levelUp = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "level_up")); + public static final SoundEvent loopcast = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "loopcast")); + public static final SoundEvent book = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book")); + public static final SoundEvent bookFlip = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book_flip")); + public static final SoundEvent bookOpen = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book_open")); @SubscribeEvent public static void registerSounds(RegisterEvent evt) { evt.register(ForgeRegistries.Keys.SOUND_EVENTS, helper -> { - bulletCreate = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "bullet_create")); - cadCreate = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "cad_create")); - cadShoot = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "cad_shoot")); - compileError = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "compile_error")); - levelUp = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "level_up")); - loopcast = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "loopcast")); - book = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book")); - bookFlip = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book_flip")); - bookOpen = new SoundEvent(new ResourceLocation(LibMisc.MOD_ID, "book_open")); - helper.register(bulletCreate.getLocation(), bulletCreate); helper.register(cadCreate.getLocation(), cadCreate); helper.register(cadShoot.getLocation(), cadShoot);