Class WeighedSoundEvents
java.lang.Object
net.minecraft.client.sounds.WeighedSoundEvents
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a sound event to the collection.getSound(RandomSource random) Retrieves a randomly selected sound from the sound events based on their weights.@Nullable ComponentintvoidpreloadIfRequired(SoundEngine soundEngine) Preloads the sound events into the sound engine if required.
-
Field Details
-
list
-
subtitle
-
-
Constructor Details
-
WeighedSoundEvents
- Parameters:
location- The resource location of the sound eventssubtitle- The key for the subtitle translation component, or null if no subtitle is provided
-
-
Method Details
-
getWeight
-
getSound
Retrieves a randomly selected sound from the sound events based on their weights. The selection is performed using the provided random source. -
addSound
-
getSubtitle
-
preloadIfRequired
Preloads the sound events into the sound engine if required. This method is called to preload the sounds associated with the sound events into the sound engine, ensuring they are ready for playback.- Specified by:
preloadIfRequiredin interfaceWeighted<Sound>- Parameters:
soundEngine- The sound engine used for sound preloading
-