Class SoundBuilder
java.lang.Object
io.github.vampirestudios.vampirelib.api.datagen.SoundBuilder
Utility class for building a sound entry with a given set of properties, without necessarily passing them all as parameters.
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonElementbuild()static SoundBuilderevent(net.minecraft.resources.ResourceLocation name) Build an entry corresponding to an existingSoundEvent.net.minecraft.resources.ResourceLocationgetName()preload()Dictates that this sound should be loaded in advance when loading the resource pack containing it rather than when the sound itself plays.setAttenuationDistance(int attenuationDistance) Sets the reduction rate of this sound depending on distance from the source.setPitch(float pitch) Sets the pitch that the sound should play at.setVolume(float volume) Sets the volume that the sound should play at as a number between0.0and1.0.setWeight(int weight) Sets how much likelier it should be for this sound to play.static SoundBuildersound(net.minecraft.resources.ResourceLocation name) Build an entry corresponding to a sound file.stream()Dictates that this sound should be streamed from its file.
-
Method Details
-
getName
public net.minecraft.resources.ResourceLocation getName() -
sound
Build an entry corresponding to a sound file.- Parameters:
name- The name of the sound as a namespaced ID with relative folder path.
-
event
Build an entry corresponding to an existingSoundEvent.- Parameters:
name- The ID of the sound event.
-
setVolume
Sets the volume that the sound should play at as a number between0.0and1.0. Defaults to1.0. -
setPitch
Sets the pitch that the sound should play at. Note that this is internally clamped in-game between 0.5 and 2.0. -
setWeight
Sets how much likelier it should be for this sound to play. For example, setting this to 2 will mean that this sound is twice as likely to play for this event. -
stream
Dictates that this sound should be streamed from its file. Recommended for sounds with a much longer play time than a couple of seconds, such as music tracks, in order to minimise lag. If set, only 4 instances of this sound can play in-game at once. -
setAttenuationDistance
Sets the reduction rate of this sound depending on distance from the source. Defaults to 16. -
preload
Dictates that this sound should be loaded in advance when loading the resource pack containing it rather than when the sound itself plays. -
build
public com.google.gson.JsonElement build()
-