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 Configurate ConfigurationNode.
Since:
1.0.0
  • Method Details

    • tagToNode

      public static void tagToNode(net.minecraft.nbt.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 convert
      node - the node to populate
      Throws:
      IOException - if invalid tags are provided
      Since:
      1.0.0
    • nodeToTag

      public static net.minecraft.nbt.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

      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
    • nodeFactory

      Get a factory for nodes prepared to handle NBT data.
      Returns:
      the factory
      Since:
      3.0.0