Interface SoundTypeBuilder
sounds.json file.
Use in conjunction with FabricSoundsProvider to generate sound definitions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for creating a weighted sound entry that can be played for a particular sound type.static enumRepresents the type of weighted sound entry. -
Method Summary
Modifier and TypeMethodDescriptioncategory(SoundCategory category) Sets the sound category the sound event must play on.static SoundTypeBuilderof()Creates a new empty builder.static SoundTypeBuilderof(SoundEvent event) Creates a new builder pre-filled with a subtitle translation key string based on the passed event.Adds one sound to the event.sound(SoundTypeBuilder.EntryBuilder sound, int count) Adds one or more sounds to the event.Sets an optional translation key string to use for the sound's subtitle.
-
Method Details
-
of
Creates a new builder pre-filled with a subtitle translation key string based on the passed event.Note: To generate a translation value, use
FabricLanguageProvider.TranslationBuilder.add(SoundEvent, String).- Returns:
- New sound type builder
-
of
Creates a new empty builder.- Returns:
- New sound type builder
-
category
Sets the sound category the sound event must play on.The default category is
SoundCategory.NEUTRAL. GUI elements should useSoundCategory.MASTER. -
subtitle
Sets an optional translation key string to use for the sound's subtitle.The default is null (no subtitle).
Note: To generate a translation value, use
FabricLanguageProvider.TranslationBuilder.add(SoundEvent, String). -
sound
Adds one sound to the event.- Parameters:
sound- base sound to add
-
sound
Adds one or more sounds to the event.This is a shorthand method for quickly adding multiple entries where each sound is a variant with an index at the end of their name.
Calling this with the a count value of
3is the equivalent of doing:builder.sound(EntryBuilder.ofFile(id.withSuffixedPath("1"));builder.sound(EntryBuilder.ofFile(id.withSuffixedPath("2"));builder.sound(EntryBuilder.ofFile(id.withSuffixedPath("3"));- Parameters:
sound- base sound to addcount- number of instances of that sound to register
-