Posted June 30, 20196 yr It seems to be a cart before the horse issue: items are registered before sounds so the record has no sound attached to it. I can get around this by using a static initialiser, but I'm looking for other options. I also have a similar issue using custom spawn eggs: the entity type is a null. In this case I'm using spawn eggs directly so they can be placed in my mod's creative tab. @ObjectHolder(References.MODID) public class JungleSounds { public static SoundEvent RECORD_SURVIVORS; public static SoundEvent SAUROHN_DEATH; public static SoundEvent SAUROHN_HURT; public static SoundEvent SAUROHN_LAUGH; public static SoundEvent SAUROHN_MOCK; public static SoundEvent SAUROHN_TALK; public static void init() //Not currently called, doesn't work if used from pre-init { /*RECORD_SURVIVORS = registerSound("records.eyetyrant"); SAUROHN_DEATH = registerSound("saurohn.saurohn_death"); SAUROHN_HURT = registerSound("saurohn.saurohn_hurt"); SAUROHN_LAUGH = registerSound("saurohn.saurohn_laugh"); SAUROHN_MOCK = registerSound("saurohn.saurohn_mock"); SAUROHN_TALK = registerSound("saurohn.saurohn_talk");*/ } private static SoundEvent registerSound(String soundName) { //soundID;//SoundEvent soundID = IRegistry.field_212633_v.func_212608_b(new ResourceLocation(soundName)); final ResourceLocation soundID = new ResourceLocation(References.MODID, soundName); return new SoundEvent(soundID).setRegistryName(soundID); } @EventBusSubscriber(modid = References.MODID, bus = EventBusSubscriber.Bus.MOD) public static class RegistrationHandlerSound { @SubscribeEvent public static void registerSoundEvents(final RegistryEvent.Register<SoundEvent> event) { init(); event.getRegistry().registerAll ( RECORD_SURVIVORS = registerSound("records.eyetyrant"), SAUROHN_DEATH = registerSound("saurohn.saurohn_death"), SAUROHN_HURT = registerSound("saurohn.saurohn_hurt"), SAUROHN_LAUGH = registerSound("saurohn.saurohn_laugh"), SAUROHN_MOCK = registerSound("saurohn.saurohn_mock"), SAUROHN_TALK = registerSound("saurohn.saurohn_talk") ); } } Edited June 30, 20196 yr by salvestrom
June 30, 20196 yr I ended up initialising my SoundEvents in a method called from RegistryEvent.Register<Item> and storing them in a temporary Map until they're registered in RegistryEvent.Register<SoundEvent>. You can see this here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.