Class NbtPath

java.lang.Object
net.lenni0451.imnbt.utils.nbt.NbtPath

public class NbtPath extends Object
Utils to generate a unique path for a tag.
  • Constructor Details

    • NbtPath

      public NbtPath()
  • Method Details

    • get

      public static String get(String path, String node)
      Get the new path of a simple tag.
      e.g. "root" + "node" -> "root.node"
      Parameters:
      path - The current path
      node - The node to add
      Returns:
      The new path
    • get

      public static String get(String path, int index)
      Get the new path of an array/list entry.
      e.g. "root" + 0 -> "root[0]"
      Parameters:
      path - The current path
      index - The index to add
      Returns:
      The new path
    • get

      public static String get(String path, String node, int index)
      Get the new path of an array/list entry with from a node.
      e.g. "root" + "node" + 0 -> "root.node[0]"
      Parameters:
      path - The current path
      node - The node to add
      index - The index to add
      Returns:
      The new path
    • parse

      public static NbtPath.IPathNode[] parse(String path)
      Parse the string path into an NbtPath.IPathNode array.
      Parameters:
      path - The path to parse
      Returns:
      The parsed path
    • build

      public static String build(NbtPath.IPathNode[] nodes)
      Build a string path from an NbtPath.IPathNode array.
      Parameters:
      nodes - The path nodes
      Returns:
      The string path
    • split

      public static String[] split(String path)
      Split a string path into a string array.
      Parameters:
      path - The path to split
      Returns:
      The split path
    • getTags

      public static void getTags(Map<String,net.lenni0451.mcstructs.nbt.NbtTag> tags, net.lenni0451.mcstructs.nbt.NbtTag tag, String path)
      Get all tags with their path from an input tag.
      Only useful when passing a list or compound tag.
      Parameters:
      tags - The map to put the tags in
      tag - The input tag (preferably a list or compound tag)
      path - The path of the input tag