Litematica

Litematica

8M Downloads

Automatically generate Litematica file

MrZillaGold opened this issue · 4 comments

commented

I would like to automatically generate files for Litematica, preferably I would like to use JSON. If I'm not mistaken, the mod supports this type of file.

What structure should the file have?

commented

Which files are you referring to? I assume schematics, and not the config files (which do use the JSON format)?

Litematica does not currently support any JSON schematic formats, because I'm not aware of any such formats being widely used anywhere. The current 1.12 code supports 4 different formats: Litematica's own format, the old MCEdit/Schematica format, the new-ish Sponge schematic format and the vanilla structure block template format.

commented

Suppose I want to generate a Litematic file, what should it consist of and what structure should it have?

commented

The format was discussed a bit here: #53
You can also use NBTExplorer to look at some schematics saved by the mod itself. The most complicated part of the Litematica schematic is generating the bit-packed long array that holds the IDs that refer to the block palette.

If you want to generate files externally, then the Sponge schematic format might be a little bit simpler to handle, because it just uses varint values for the IDs, so each block position in the schematic is byte aligned in the array.

If you want to see code examples, all the schematic saving/loading related code for the supported 4 formats is in the classes in this package: https://github.com/maruohon/litematica/tree/master/src/main/java/fi/dy/masa/litematica/schematic

commented

Thanks!