Class SNBTConverter
java.lang.Object
io.github.projectunified.craftitem.nbt.SNBTConverter
Converts Java objects to SNBT (Minecraft's text NBT format).
Converts maps, lists, arrays, and primitives to SNBT strings with proper formatting. Supports data component format with brackets and equals syntax.
Example:
SNBTConverter.convert(Map.of("key", 42, "name", "test"));
// Returns: {key:42,name:"test"}
SNBTConverter.convert(Map.of("key", 42), true);
// Returns: [key=42]
-
Method Summary
-
Method Details
-
convert
Converts a value to SNBT string format- Parameters:
value- The value to convert- Returns:
- SNBT formatted string
-
convert
Converts a value to SNBT string format- Parameters:
value- The value to convertuseDataComponentFormat- If true, use Minecraft data component format- Returns:
- SNBT formatted string
-