Package net.minecraftforge.common.data
Class SoundDefinitionsProvider
java.lang.Object
net.minecraftforge.common.data.SoundDefinitionsProvider
- All Implemented Interfaces:
- DataProvider
- Direct Known Subclasses:
- VanillaSoundDefinitionsProvider
Data provider for the 
sounds.json file, which identifies sound definitions
 for the various sound events in Minecraft.- 
Nested Class SummaryNested classes/interfaces inherited from interface net.minecraft.data.DataProviderDataProvider.Factory<T extends DataProvider>
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final ExistingFileHelperprivate static final org.apache.logging.log4j.Loggerprivate final Stringprivate final PackOutputprivate final Map<String,SoundDefinition> Fields inherited from interface net.minecraft.data.DataProviderFIXED_ORDER_FIELDS, KEY_COMPARATOR
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedSoundDefinitionsProvider(PackOutput output, String modId, ExistingFileHelper helper) Creates a new instance of this data provider.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidadd(String soundEvent, SoundDefinition definition) Adds theSoundEventwith the specified name along with itsSoundDefinitionto the list.protected voidadd(Supplier<SoundEvent> soundEvent, SoundDefinition definition) Adds the entry name associated with the suppliedSoundEventwith the givenSoundDefinitionto the list.protected voidadd(ResourceLocation soundEvent, SoundDefinition definition) protected voidadd(SoundEvent soundEvent, SoundDefinition definition) Adds the entry name associated with the givenSoundEventwith theSoundDefinitionto the list.private voidaddSounds(String soundEvent, SoundDefinition definition) protected static SoundDefinitionCreates a newSoundDefinition, which will host a set ofSoundDefinition.Sounds and the necessary parameters.getName()private com.google.gson.JsonObjectmapToJson(Map<String, SoundDefinition> map) abstract voidRegisters the sound definitions that should be generated via one of theaddmethods.run(CachedOutput cache) private CompletableFuture<?>save(CachedOutput cache, Path targetFile) protected static SoundDefinition.SoundCreates a new sound with the given name andSoundDefinition.SoundType.SOUNDas sound type.protected static SoundDefinition.Soundsound(String name, SoundDefinition.SoundType type) Creates a new sound with the given name and type.protected static SoundDefinition.Soundsound(ResourceLocation name) Creates a new sound with the given name andSoundDefinition.SoundType.SOUNDas sound type.protected static SoundDefinition.Soundsound(ResourceLocation name, SoundDefinition.SoundType type) Creates a new sound with the given name and type.private voidvalidate()private booleanvalidate(String name, SoundDefinition def) private booleanvalidate(String name, SoundDefinition.Sound sound) private booleanvalidateEvent(String soundName, ResourceLocation name) private booleanvalidateSound(String soundName, ResourceLocation name) 
- 
Field Details- 
LOGGERprivate static final org.apache.logging.log4j.Logger LOGGER
- 
output
- 
modId
- 
helper
- 
sounds
 
- 
- 
Constructor Details- 
SoundDefinitionsProviderCreates a new instance of this data provider.- Parameters:
- output- The PackOutput instance provided by the data generator.
- modId- The mod ID of the current mod.
- helper- The existing file helper provided by the event you are initializing this provider in.
 
 
- 
- 
Method Details- 
registerSoundspublic abstract void registerSounds()Registers the sound definitions that should be generated via one of theaddmethods.
- 
run- Specified by:
- runin interface- DataProvider
 
- 
getName- Specified by:
- getNamein interface- DataProvider
 
- 
definitionCreates a newSoundDefinition, which will host a set ofSoundDefinition.Sounds and the necessary parameters.
- 
soundCreates a new sound with the given name and type.- Parameters:
- name- The name of the sound to create.
- type- The type of sound to create.
 
- 
soundCreates a new sound with the given name andSoundDefinition.SoundType.SOUNDas sound type.- Parameters:
- name- The name of the sound to create.
 
- 
soundCreates a new sound with the given name and type.- Parameters:
- name- The name of the sound to create.
- type- The type of sound to create.
 
- 
soundCreates a new sound with the given name andSoundDefinition.SoundType.SOUNDas sound type.- Parameters:
- name- The name of the sound to create.
 
- 
addAdds the entry name associated with the suppliedSoundEventwith the givenSoundDefinitionto the list.This method should be preferred when dealing with a RegistryObjectorRegistryDelegate.- Parameters:
- soundEvent- A- Supplierfor the given- SoundEvent.
- definition- A- SoundDefinitionthat defines the given sound.
 
- 
addAdds the entry name associated with the givenSoundEventwith theSoundDefinitionto the list.This method should be preferred when a SoundEventis already available in the method context. If you already have aSupplierfor it, refer toadd(Supplier, SoundDefinition).- Parameters:
- soundEvent- A- SoundEvent.
- definition- The- SoundDefinitionthat defines the given event.
 
- 
add- Parameters:
- soundEvent- The- ResourceLocationthat identifies the event.
- definition- The- SoundDefinitionthat defines the given event.
 
- 
addAdds theSoundEventwith the specified name along with itsSoundDefinitionto the list.The given sound event must NOT contain the namespace the name is a part of, since the sound definition specification doesn't allow sounds to be defined outside the namespace they're in. For this reason, any namespace will automatically be stripped from the name. - Parameters:
- soundEvent- The name of the- SoundEvent.
- definition- The- SoundDefinitionthat defines the given event.
 
- 
addSounds
- 
validateprivate void validate()
- 
validate
- 
validate
- 
validateSound
- 
validateEvent
- 
save
- 
mapToJson
 
-