MikuAuahDark / lua-nbt

NBT library for Lua
zlib License
5 stars 2 forks source link

Can it handle structure files? #1

Open vico93 opened 1 year ago

vico93 commented 1 year ago

Not .schematic, but the .nbt files generated by Structure Blocks and used by vanilla Minecraft.

MikuAuahDark commented 1 year ago

Looking at the spec, since there are no changes to it as far as I know, it should able to.

Note that if it's compressed, you must decompress it yourself. This library only deals with raw NBT data, not the compressed ones.

vico93 commented 1 year ago

Well, i tried to plug the library on CraftOS and tried to parse a uncompressed structure file. It returned something like this:

TAG_Compound(""): 7 entries
{
  TAG_List("size"): 3 entries
  {
    TAG_Int(None): 6
    TAG_Int(None): 9
    TAG_Int(None): 5
  }
  TAG_List("entities"): 0 entries
  {

  }

...

I'm really a newbie about this, i just want to "convert" the structure into an 3d array to allow my turtle to build that (each block type assigned to a slot). I dunno if its the right way...

MikuAuahDark commented 1 year ago

The first one looks correct to me. Minecraft always uses empty named TAG_Compound at the beginning on all of their NBTs.

Since structure block NBT format looks like undocumented, I can't say much. You probably need to look on the other fields.