Created
November 10, 2020 14:43
-
-
Save TheNathanSpace/8eb86a41c1097810b86e4a0ad0d42237 to your computer and use it in GitHub Desktop.
Register sounds using DeferredRegister
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mod.EventBusSubscriber (modid = MODID) | |
public class ModSounds | |
{ | |
public static void registerSounds() | |
{ | |
SOUNDS.register(FMLJavaModLoadingContext.get().getModEventBus()); | |
} | |
private static final DeferredRegister<SoundEvent> SOUNDS = new DeferredRegister<>(ForgeRegistries.SOUND_EVENTS, MODID); | |
public static final RegistryObject<SoundEvent> SOUND_123 = SOUNDS.register("123", () -> new SoundEvent(new ResourceLocation(MODID, "123"))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mod ("mymod") | |
public class MYMOD | |
{ | |
public static final String MODID = "mymod"; | |
public MYMOD() | |
{ | |
ModSounds.registerSounds(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment