Sounds

There also exists different types of sounds but they're so similiar that they are all made with one method (similar to how textures work)

resources.sound(<Path/File object pointing to your .ogg sound file>, "<sound type (record/neutral/entity/etc.)>", "<internal resource name (optional)>");
// This code registers the "test.ogg" file in the game instance directory as a music disc sound 
VirtualResourcePack resources = new VirtualResourcePack("some_mod_id");
resources.sound(FMLPaths.GAMEDIR.get().resolve("test.ogg"), "record");

Note: Don't forget to also register your sound with <sound event register>.register("<some name>", () -> new SoundEvent(new ResourceLocation("<mod id>", "<file name without the .ogg>")));

Last updated