Class SoundFile.Builder
java.lang.Object
de.mrjulsen.dragnsounds.core.filesystem.SoundFile.Builder
- Enclosing class:
- SoundFile
Data collection to create a new sound file on the server.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deserializeNbt
(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level) static SoundFile.Builder
fromNbt
(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level) save
(UUID owner, ByteArrayOutputStream dataStream, int initialChannels, long initialDuration) Create the new sound file and write it to disk.net.minecraft.nbt.CompoundTag
-
Constructor Details
-
Builder
- Parameters:
location
- The location where the sound file should be stored in.displayName
- The display name of the sound file (not the filename). Can contain any characters.initialMetadata
- A collection of metadata that should be added after creating the file.
-
-
Method Details
-
save
public SoundFile save(UUID owner, ByteArrayOutputStream dataStream, int initialChannels, long initialDuration) throws IOException, ws.schild.jave.InputFormatException, ws.schild.jave.EncoderException Create the new sound file and write it to disk.- Parameters:
owner
- The owner of the sound file (usually the UUID of the player).dataStream
- The stream containing all the data of the file.initialChannels
- A fallback option to get the amount of audio channels which is calculated on the client side (may be manipulated there too)initialDuration
- A fallback option to get the audio playback duration which is calculated on the client side (may be manipulated there too)- Returns:
- A SoundFile object of the new file.
- Throws:
IOException
ws.schild.jave.InputFormatException
ws.schild.jave.EncoderException
- Impl Note:
- You should not call this method by yourself, as this is managed by the library.
- Valid on side:
- Server
-
serializeNbt
public net.minecraft.nbt.CompoundTag serializeNbt() -
deserializeNbt
public void deserializeNbt(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level) -
fromNbt
public static SoundFile.Builder fromNbt(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level)
-