Package net.minecraft.client.sounds
Class SoundBufferLibrary
java.lang.Object
net.minecraft.client.sounds.SoundBufferLibrary
The SoundBufferLibrary class provides a cache containing instances of SoundBuffer and AudioStream for use in Minecraft sound handling.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Identifier, CompletableFuture<SoundBuffer>> private final ResourceProviderThe ResourceProvider used for loading sound resources. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()getCompleteBuffer(Identifier soundId) getStream(Identifier resourceLocation, boolean isWrapper) preload(Collection<Sound> sounds) Preloads the SoundBuffer objects for the specified collection of sounds.
-
Field Details
-
resourceManager
The ResourceProvider used for loading sound resources. -
cache
-
-
Constructor Details
-
SoundBufferLibrary
-
-
Method Details
-
getCompleteBuffer
- Parameters:
soundId- the Identifier of the sound- Returns:
- a CompletableFuture containing the complete SoundBuffer. The SoundBuffer is loaded asynchronously and cached.
-
getStream
- Parameters:
resourceLocation- the Identifier of the soundisWrapper- whether the AudioStream should be a invalid input: '{@' linkplain LoopingAudioStream}- Returns:
- a CompletableFuture containing the AudioStream. The AudioStream is loaded asynchronously.
-
clear
public void clear() -
preload
Preloads the SoundBuffer objects for the specified collection of sounds.- Parameters:
sounds- the collection of sounds to preload- Returns:
- a CompletableFuture representing the completion of the preload operation
-