Klasse SoundLocation

java.lang.Object
de.mrjulsen.dragnsounds.core.filesystem.SoundLocation
Alle implementierten Schnittstellen:
de.mrjulsen.mcdragonlib.data.INBTSerializable

public class SoundLocation extends Object implements de.mrjulsen.mcdragonlib.data.INBTSerializable
An object to locate sound files.
  • Felddetails

    • level

      protected net.minecraft.world.level.Level level
    • namespace

      protected String namespace
    • relativePath

      protected String relativePath
  • Konstruktordetails

    • SoundLocation

      public SoundLocation(net.minecraft.world.level.Level level, String namespace, String relativePath)
      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

      public SoundLocation(net.minecraft.world.level.Level level, String location)
      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

      public SoundLocation(net.minecraft.world.level.Level level, Path location)
  • 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

      public String 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

      public String getRelativePath()
      Gibt zurück:
      The relative path within the namespace folder.
    • buildPath

      public String 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

      public final Optional<Path> 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

      public static final Path getModDirectory(net.minecraft.world.level.Level level)
      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()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • serializeNbt

      public net.minecraft.nbt.CompoundTag serializeNbt()
      Angegeben von:
      serializeNbt in Schnittstelle de.mrjulsen.mcdragonlib.data.INBTSerializable
    • deserializeNbt

      public void deserializeNbt(net.minecraft.nbt.CompoundTag nbt)
      Angegeben von:
      deserializeNbt in Schnittstelle de.mrjulsen.mcdragonlib.data.INBTSerializable
    • fromNbt

      public static SoundLocation fromNbt(net.minecraft.nbt.CompoundTag nbt, net.minecraft.world.level.Level level)
    • empty

      public static SoundLocation empty()