类 SoundDefinitionsProvider
java.lang.Object
net.neoforged.neoforge.common.data.SoundDefinitionsProvider
- 所有已实现的接口:
DataProvider
Data provider for the
sounds.json
file, which identifies sound definitions
for the various sound events in Minecraft.-
嵌套类概要
从接口继承的嵌套类/接口 net.minecraft.data.DataProvider
DataProvider.Factory<T extends DataProvider>
-
字段概要
字段修饰符和类型字段说明private static final org.apache.logging.log4j.Logger
private final String
private final PackOutput
private final Map
<String, SoundDefinition> 从接口继承的字段 net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR
-
构造器概要
构造器限定符构造器说明protected
SoundDefinitionsProvider
(PackOutput output, String modId) Creates a new instance of this data provider. -
方法概要
修饰符和类型方法说明protected void
add
(String soundEvent, SoundDefinition definition) Adds theSoundEvent
with the specified name along with itsSoundDefinition
to the list.protected void
add
(Supplier<SoundEvent> soundEvent, SoundDefinition definition) Adds the entry name associated with the suppliedSoundEvent
with the givenSoundDefinition
to the list.protected void
add
(ResourceLocation soundEvent, SoundDefinition definition) protected void
add
(SoundEvent soundEvent, SoundDefinition definition) Adds the entry name associated with the givenSoundEvent
with theSoundDefinition
to the list.private void
addSounds
(String soundEvent, SoundDefinition definition) protected static SoundDefinition
Creates a newSoundDefinition
, which will host a set ofSoundDefinition.Sound
s and the necessary parameters.getName()
private com.google.gson.JsonObject
mapToJson
(Map<String, SoundDefinition> map) abstract void
Registers the sound definitions that should be generated via one of theadd
methods.run
(CachedOutput cache) private CompletableFuture
<?> save
(CachedOutput cache, Path targetFile) protected static SoundDefinition.Sound
Creates a new sound with the given name andSoundDefinition.SoundType.SOUND
as sound type.protected static SoundDefinition.Sound
sound
(String name, SoundDefinition.SoundType type) Creates a new sound with the given name and type.protected static SoundDefinition.Sound
sound
(ResourceLocation name) Creates a new sound with the given name andSoundDefinition.SoundType.SOUND
as sound type.protected static SoundDefinition.Sound
sound
(ResourceLocation name, SoundDefinition.SoundType type) Creates a new sound with the given name and type.private void
validate()
private boolean
validate
(String name, SoundDefinition def)
-
字段详细资料
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
output
-
modId
-
sounds
-
-
构造器详细资料
-
SoundDefinitionsProvider
Creates a new instance of this data provider.- 参数:
output
- The PackOutput instance provided by the data generator.modId
- The mod ID of the current mod.
-
-
方法详细资料
-
registerSounds
public abstract void registerSounds()Registers the sound definitions that should be generated via one of theadd
methods. -
run
- 指定者:
run
在接口中DataProvider
-
getName
- 指定者:
getName
在接口中DataProvider
-
definition
Creates a newSoundDefinition
, which will host a set ofSoundDefinition.Sound
s and the necessary parameters. -
sound
Creates a new sound with the given name and type.- 参数:
name
- The name of the sound to create.type
- The type of sound to create.
-
sound
Creates a new sound with the given name andSoundDefinition.SoundType.SOUND
as sound type.- 参数:
name
- The name of the sound to create.
-
sound
Creates a new sound with the given name and type.- 参数:
name
- The name of the sound to create.type
- The type of sound to create.
-
sound
Creates a new sound with the given name andSoundDefinition.SoundType.SOUND
as sound type.- 参数:
name
- The name of the sound to create.
-
add
Adds the entry name associated with the suppliedSoundEvent
with the givenSoundDefinition
to the list.This method should be preferred when dealing with a
RegistryObject
orRegistryDelegate
.- 参数:
soundEvent
- ASupplier
for the givenSoundEvent
.definition
- ASoundDefinition
that defines the given sound.
-
add
Adds the entry name associated with the givenSoundEvent
with theSoundDefinition
to the list.This method should be preferred when a
SoundEvent
is already available in the method context. If you already have aSupplier
for it, refer toadd(Supplier, SoundDefinition)
.- 参数:
soundEvent
- ASoundEvent
.definition
- TheSoundDefinition
that defines the given event.
-
add
- 参数:
soundEvent
- TheResourceLocation
that identifies the event.definition
- TheSoundDefinition
that defines the given event.
-
add
Adds theSoundEvent
with the specified name along with itsSoundDefinition
to 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.
- 参数:
soundEvent
- The name of theSoundEvent
.definition
- TheSoundDefinition
that defines the given event.
-
addSounds
-
validate
private void validate() -
validate
-
save
-
mapToJson
-