Class SNBTSerializer

java.lang.Object
de.pauleff.formats.snbt.SNBTSerializer

public class SNBTSerializer extends Object
Serializer for converting NBT tags into SNBT (Stringified NBT) format. Produces valid SNBT strings that can be used in Minecraft commands and debugging. Uses Minecraft-compatible formatting by default.
  • Constructor Details

    • SNBTSerializer

      public SNBTSerializer()
      Creates a serializer with Minecraft-compatible formatting.
  • Method Details

    • serialize

      public String serialize(ITag<?> tag)
      Serializes an NBT tag to SNBT string format.
      Parameters:
      tag - the NBT tag to serialize
      Returns:
      the SNBT string representation
    • writeToFile

      public void writeToFile(ITag<?> tag, File file) throws IOException
      Writes an NBT tag to a text file in SNBT format.
      Parameters:
      tag - the NBT tag to serialize
      file - the file to write to
      Throws:
      IOException - if writing fails