Skip to content

Commit

Permalink
NBT XML?
Browse files Browse the repository at this point in the history
Looking into being able to store NBT as XML! I think I'm just curious how this might be able to be interesting in terms of possibly reactive components, and or JSX, and just composability in general. You wouldn't want to write it out by hand like this, but maybe instead it could be a way to render NBT in a vector format, say like with SVG :O

#46

Got some help from GPT and the web in general (along with some of my own validations) to get what would be the XML entities for the odd characters I have experimented with serializing, like newlines, tabs, things like those.

This file was written by hand, as a transform from the original `bigtest.snbt` file. I am going to see if I can make a custom parser and writer for XML, which goes between NBTify JS primitives, and XML strings. Seems like it could be another great way to make NBT interop even greater!
  • Loading branch information
Offroaders123 committed Oct 9, 2024
1 parent 2525323 commit 4d7b970
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/nbt/bigtest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<CompoundTag name="Level">
<LongTag name="longTest">9223372036854775807</LongTag>
<ShortTag name="shortTest">32767</ShortTag>
<StringTag name="stringTest">HELLO WORLD THIS IS A TEST STRING ÅÄÖ!</StringTag>
<FloatTag name="floatTest">0.4982314705848694</FloatTag>
<IntTag name="intTest">2147483647</IntTag>
<CompoundTag name="nested compound test">
<CompoundTag name="ham">
<StringTag name="name">Hampus</StringTag>
<FloatTag name="value">0.75</FloatTag>
</CompoundTag>
<CompoundTag name="egg">
<StringTag name="name">Eggbert</StringTag>
<FloatTag name="value">0.5</FloatTag>
</CompoundTag>
</CompoundTag>
<ListTag name="listTest (long)">[11l, 12l, 13l, 14l, 15l]</ListTag>
<ListTag name="listTest (compound)">
<CompoundTag>
<StringTag name="name">Compound tag #0</StringTag>
<LongTag name="created-on">1264099775885</LongTag>
</CompoundTag>
<CompoundTag>
<StringTag name="name">Compound tag #1</StringTag>
<LongTag name="created-on">1264099775885</LongTag>
</CompoundTag>
</ListTag>
<ByteTag name="byteTest">127</ByteTag>
<DoubleTag name="doubleTest">0.4931287132182315</DoubleTag>
<ByteArrayTag name="byteArrayTest">
<ByteTag>0</ByteTag>
<ByteTag>62</ByteTag>
<ByteTag>34</ByteTag>
<ByteTag>16</ByteTag>
<ByteTag>8</ByteTag>
</ByteArrayTag>
<IntArrayTag name="intArrayTest">
<IntTag>543</IntTag>
<IntTag>123</IntTag>
<IntTag>7567</IntTag>
<IntTag>244</IntTag>
</IntArrayTag>
<LongArrayTag name="longArrayTest">
<LongTag>7676</LongTag>
<LongTag>53534</LongTag>
<LongTag>34534</LongTag>
<LongTag>345345345</LongTag>
</LongArrayTag>
<StringTag name="escapedString">"noice, I gotchya"</StringTag>
<StringTag name="escapeSequences">&#x8;&#xC;&#xA;&#13;&#x9;"'\</StringTag>
<StringTag name="otherEscape">"</StringTag>
</CompoundTag>

0 comments on commit 4d7b970

Please sign in to comment.