Class ModSounds

java.lang.Object
net.kamkeyke.example.registry.ModSounds

@Internal public class ModSounds extends Object
Example Class of registry for all sound events of the mod.

This class also acts as the single source of truth for SoundEntry, which are later used by AutoSoundProvider to automatically register all SoundEvents.

Recommended pattern: To keep your code clean and avoid repetition, create helper methods like singleSound, variedSound, and customPaths.

Example:


 public static final RegistryObject<SoundEvent> VINE_BOOM =
     singleSound("vine_boom", "sfx/misc/vine_boom");

 public static final RegistryObject<SoundEvent> FIRE_CRACKLING =
     variedSound("fire_crackling", "sfx/fire_cracklings/fire_crackling", 5);
 

These helpers already register the SoundEvent and add a corresponding SoundEntry for AutoSoundProvider datagen.


This class was not registered in the ModEventBus and therefore will not appear in-game.

It serves only as an example.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<SoundEntry>
     
    static final net.minecraftforge.registries.DeferredRegister<net.minecraft.sounds.SoundEvent>
     
    static final net.minecraftforge.registries.RegistryObject<net.minecraft.sounds.SoundEvent>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    register(net.minecraftforge.eventbus.api.IEventBus eventBus)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • entries

      public static final List<SoundEntry> entries
    • SOUND_EVENTS

      public static final net.minecraftforge.registries.DeferredRegister<net.minecraft.sounds.SoundEvent> SOUND_EVENTS
    • VINE_BOOM

      public static final net.minecraftforge.registries.RegistryObject<net.minecraft.sounds.SoundEvent> VINE_BOOM
  • Constructor Details

    • ModSounds

      public ModSounds()
  • Method Details

    • register

      public static void register(net.minecraftforge.eventbus.api.IEventBus eventBus)