Skip to content

Commit

Permalink
fix: sound events crashing servers on release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamefrede committed Dec 11, 2023
1 parent 408d8d0 commit c8a1627
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.properties
Expand Up @@ -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
Expand Down
28 changes: 9 additions & 19 deletions src/main/java/vazkii/psi/common/core/handler/PsiSoundHandler.java
Expand Up @@ -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);
Expand Down

0 comments on commit c8a1627

Please sign in to comment.