Klasse SoundLocation
java.lang.Object
de.mrjulsen.dragnsounds.core.filesystem.SoundLocation
- Alle implementierten Schnittstellen:
de.mrjulsen.mcdragonlib.data.INBTSerializable
An object to locate sound files.
-
Feldübersicht
-
Konstruktorübersicht
KonstruktorBeschreibungSoundLocation
(net.minecraft.world.level.Level level, String location) Creates an object to locate a specific folder containing the desired sound files.SoundLocation
(net.minecraft.world.level.Level level, String namespace, String relativePath) Creates an object to locate a specific folder containing the desired sound files.SoundLocation
(net.minecraft.world.level.Level level, Path location) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
deserializeNbt
(net.minecraft.nbt.CompoundTag nbt) static SoundLocation
empty()
boolean
static SoundLocation
fromNbt
(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level) net.minecraft.world.level.Level
getLevel()
The world the sound is located in.static final Path
getModDirectory
(net.minecraft.world.level.Level level) int
hashCode()
static boolean
isAllowedInNamespace
(char character) static boolean
isAllowedInPath
(char character) static boolean
isAllowedInSoundLocation
(char character) resolve()
Validates the given path to prevent access of files outside the sound's root directory.net.minecraft.nbt.CompoundTag
void
setLevel
(net.minecraft.world.level.Level level) toString()
-
Felddetails
-
level
protected net.minecraft.world.level.Level level -
namespace
-
relativePath
-
-
Konstruktordetails
-
SoundLocation
Creates an object to locate a specific folder containing the desired sound files.- Parameter:
namespace
- The namespace directory name. The namespace is the first directory (root) inside the mod's data folder inside the world's data folder.relativePath
- The relative path inside the namespace directory. Can be an empty string.
-
SoundLocation
Creates an object to locate a specific folder containing the desired sound files.- Parameter:
location
- The string value of a sound location. Should contain:
to separate namespace and path.- Examples:
- namespace:path/to/file
-
SoundLocation
-
-
Methodendetails
-
setLevel
public void setLevel(net.minecraft.world.level.Level level) -
isAllowedInNamespace
public static boolean isAllowedInNamespace(char character) -
isAllowedInPath
public static boolean isAllowedInPath(char character) -
isAllowedInSoundLocation
public static boolean isAllowedInSoundLocation(char character) -
getNamespace
- Gibt zurück:
- The name of the working directory where the sound files are saved. The mod's sound folder in each world is divided into several subfolders (namespaces), each of which represents its own workspace in which each addon can work as desired. Addons can then decide for themselves whether they want to expand these working areas even further.
-
getRelativePath
- Gibt zurück:
- The relative path within the namespace folder.
-
buildPath
- Gibt zurück:
- The String of the complete relative path containing the namespace and relative path variable. (e.g.
my_namespace/my/sub/dir
)
-
resolve
Validates the given path to prevent access of files outside the sound's root directory.- Gibt zurück:
- A filled
Optional
when the given path in this object is valid.
-
getModDirectory
- Parameter:
level
- The world the sound is saved in.- Gibt zurück:
- The path to the directory inside the world's data folder where the sounds are saved.
-
getLevel
public net.minecraft.world.level.Level getLevel()The world the sound is located in.- Gibt zurück:
-
hashCode
public int hashCode() -
equals
-
toString
-
serializeNbt
public net.minecraft.nbt.CompoundTag serializeNbt()- Angegeben von:
serializeNbt
in Schnittstellede.mrjulsen.mcdragonlib.data.INBTSerializable
-
deserializeNbt
public void deserializeNbt(net.minecraft.nbt.CompoundTag nbt) - Angegeben von:
deserializeNbt
in Schnittstellede.mrjulsen.mcdragonlib.data.INBTSerializable
-
fromNbt
public static SoundLocation fromNbt(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level) -
empty
-