Package net.lenni0451.imnbt.utils.nbt
Class NbtPath
java.lang.Object
net.lenni0451.imnbt.utils.nbt.NbtPath
Utils to generate a unique path for a tag.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA path node.static final recordA path node with an index.static final recordA path node with a name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringbuild(NbtPath.IPathNode[] nodes) Build a string path from anNbtPath.IPathNodearray.static StringGet the new path of an array/list entry.
e.g.static StringGet the new path of a simple tag.
e.g.static StringGet the new path of an array/list entry with from a node.
e.g.static voidgetTags(Map<String, net.lenni0451.mcstructs.nbt.INbtTag> tags, net.lenni0451.mcstructs.nbt.INbtTag tag, String path) Get all tags with their path from an input tag.
Only useful when passing a list or compound tag.static NbtPath.IPathNode[]Parse the string path into anNbtPath.IPathNodearray.static String[]Split a string path into a string array.
-
Constructor Details
-
NbtPath
public NbtPath()
-
-
Method Details
-
get
Get the new path of a simple tag.
e.g. "root" + "node" -> "root.node"- Parameters:
path- The current pathnode- The node to add- Returns:
- The new path
-
get
Get the new path of an array/list entry.
e.g. "root" + 0 -> "root[0]"- Parameters:
path- The current pathindex- The index to add- Returns:
- The new path
-
get
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 pathnode- The node to addindex- The index to add- Returns:
- The new path
-
parse
Parse the string path into anNbtPath.IPathNodearray.- Parameters:
path- The path to parse- Returns:
- The parsed path
-
build
Build a string path from anNbtPath.IPathNodearray.- Parameters:
nodes- The path nodes- Returns:
- The string path
-
split
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.INbtTag> tags, net.lenni0451.mcstructs.nbt.INbtTag 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 intag- The input tag (preferably a list or compound tag)path- The path of the input tag
-