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
<ResourceLocation, CompletableFuture<SoundBuffer>> private final ResourceProvider
The ResourceProvider used for loading sound resources. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
getCompleteBuffer
(ResourceLocation pSoundID) Returns Returns a CompletableFuture containing the complete SoundBuffer. The SoundBuffer is loaded asynchronously and cached..getStream
(ResourceLocation pResourceLocation, boolean pIsWrapper) Returns Returns a CompletableFuture containing the AudioStream. The AudioStream is loaded asynchronously..preload
(Collection<Sound> pSounds) 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
Returns Returns a CompletableFuture containing the complete SoundBuffer. The SoundBuffer is loaded asynchronously and cached..- Parameters:
pSoundID
- the ResourceLocation of the sound- Returns:
- Returns a CompletableFuture containing the complete SoundBuffer. The SoundBuffer is loaded asynchronously and cached.
-
getStream
public CompletableFuture<AudioStream> getStream(ResourceLocation pResourceLocation, boolean pIsWrapper) Returns Returns a CompletableFuture containing the AudioStream. The AudioStream is loaded asynchronously..- Parameters:
pResourceLocation
- the ResourceLocation of the soundpIsWrapper
- whether the AudioStream should be a invalid input: '{@' linkplain LoopingAudioStream}- Returns:
- 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:
pSounds
- the collection of sounds to preload- Returns:
- a CompletableFuture representing the completion of the preload operation
-