baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Add support for the Structure Block file format (.nbt files)

Open Aryezz opened this issue 3 years ago • 2 comments

This adds support for .nbt files with the #build command. Small demo here: https://youtu.be/Gnp5JsKG9Ug

Closes #750

Notes: Tile-Entity data doesnt get read. Schematica supports this and since this is basically copy and paste from its source, it would not be difficult to add support (but i dont know enough about Baritone to know if it would make sense). Check out the Schematica source here: https://github.com/Lunatrius/Schematica/blob/master/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java#L30-L43

Also note that this is the first time i've ever done anything with Java, so you might wanna check everything twice :)

Aryezz avatar Mar 12 '22 20:03 Aryezz

If I have understood this correctly (can't test currently) minecraft:structure_void is not saved to *.nbt structure files so those contain holes where the structure void was

Yes, thats right. I guess it could be added manually, but the idea is that structure void blocks don't get saved when exporting.

Aryezz avatar Mar 16 '22 08:03 Aryezz

If you mean getDirect and getColumn swapping out null for air, that's because MapArtSchematic (and possibly third parties) assume the states are not null. This works within Baritone because MapArtSchematic filters out the air anyway and BuilerProcess can and does use inSchematic. For third parties it can cause structure void to become air, but in my opinion that's better than crashing them.

Adding boolean inSchematic(int x, int y, int z) to IStaticSchematic (with the same default implementation as in ISchematic) would probably be a good idea though. That way, if we keep patching holes with air, old code won't crash while new code can check for the holes and exclude them from whatever it's doing.

ZacSharp avatar Oct 19 '22 13:10 ZacSharp