Package net.minecraft.client.sounds
Interface Weighted<T>
- Type Parameters:
T
- The type of the element
- All Known Implementing Classes:
Sound
,WeighedSoundEvents
public interface Weighted<T>
The Weighted interface represents an element with a weight in a weighted collection.
It is used to provide weighted selection and retrieval of elements.
-
Method Summary
Modifier and TypeMethodDescriptiongetSound
(RandomSource pRandomSource) Retrieves the sound associated with the element.int
void
preloadIfRequired
(SoundEngine pEngine) Preloads the sound if required by the sound engine.
-
Method Details
-
getWeight
int getWeight() -
getSound
Retrieves the sound associated with the element. The sound is obtained using the provided random source.- Parameters:
pRandomSource
- the random source used for sound selection- Returns:
- The sound associated with the element
-
preloadIfRequired
Preloads the sound if required by the sound engine. This method is called to preload the sound associated with the element into the sound engine, ensuring it is ready for playback.- Parameters:
pEngine
- the sound engine used for sound preloading
-