Package ca.stellardrift.confabricate
Class NbtNodeAdapter
- java.lang.Object
-
- ca.stellardrift.confabricate.NbtNodeAdapter
-
public final class NbtNodeAdapter extends Object
A configuration adapter that will convert Minecraft NBT data into a ConfigurateConfigurationNode
.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConfigurationNode
createEmptyNode()
Create an empty node with options appropriate for handling NBT data.static ConfigurationNode
createEmptyNode(@NonNull ConfigurationOptions options)
Create an empty node with options appropriate for handling NBT data.static Tag
nodeToTag(ConfigurationNode node)
Convert a node to tag.static void
tagToNode(Tag tag, ConfigurationNode node)
Given a tag, convert it to a node.
-
-
-
Method Detail
-
tagToNode
public static void tagToNode(Tag tag, ConfigurationNode node) throws IOException
Given a tag, convert it to a node.Depending on the configuration of the provided node, the conversion may lose some data when roundtripped back. For example, array tags may be converted to lists if the node provided does not support arrays.
- Parameters:
tag
- the tag to convertnode
- the node to populate- Throws:
IOException
- if invalid tags are provided- Since:
- 1.0.0
-
nodeToTag
public static Tag nodeToTag(ConfigurationNode node) throws IOException
Convert a node to tag. Because NBT is strongly typed and does not permit lists with mixed types, some configuration nodes will not be convertible to Tags.- Parameters:
node
- the configuration node- Returns:
- the converted tag object
- Throws:
IOException
- if an IO error occurs while converting the tag- Since:
- 1.0.0
-
createEmptyNode
public static ConfigurationNode createEmptyNode()
Create an empty node with options appropriate for handling NBT data.- Returns:
- the new node
- Since:
- 1.0.0
-
createEmptyNode
public static ConfigurationNode createEmptyNode(@NonNull ConfigurationOptions options)
Create an empty node with options appropriate for handling NBT data.- Parameters:
options
- options to work with- Returns:
- the new node
- Since:
- 1.0.0
-
-