Package ca.stellardrift.confabricate
Class NbtNodeAdapter
java.lang.Object
ca.stellardrift.confabricate.NbtNodeAdapter
A configuration adapter that will convert Minecraft NBT data into a
Configurate
ConfigurationNode.- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationNodeCreate an empty node with options appropriate for handling NBT data.static ConfigurationNodecreateEmptyNode(@NonNull ConfigurationOptions options) Create an empty node with options appropriate for handling NBT data.Get a factory for nodes prepared to handle NBT data.static net.minecraft.nbt.TagnodeToTag(ConfigurationNode node) Convert a node to tag.static voidtagToNode(net.minecraft.nbt.Tag tag, ConfigurationNode node) Given a tag, convert it to a node.
-
Method Details
-
tagToNode
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
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
Create an empty node with options appropriate for handling NBT data.- Returns:
- the new node
- Since:
- 1.0.0
-
createEmptyNode
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
-
nodeFactory
Get a factory for nodes prepared to handle NBT data.- Returns:
- the factory
- Since:
- 3.0.0
-