Building Gadgets

Building Gadgets

101M Downloads

Not necessarily an issue, just curious

PXLCoarl opened this issue ยท 1 comments

commented

Hey guys,
i was writing a tool that made it possible to exchange blocks in the schematics generated by Building Gadgets 1.
I wanted to make something similar for BG2 as well, but i am kinda stumped by the data format.
In the old version i just had to edit the nbt data in the json array, but i am honestly abit stumped what im excaclty looking at with this new version. I just cant make any sense of the statelist :D

commented

In short, it assumes that the area copied is a rectangular prism shape (2 corners of an area). It then has a list of blockstates.

The statelist is an index of that list. Example below:

Position 0: grass_block
Position 1: air
Position 2: occultism storage controller
Position 3: occultism storage controller base
Position 4: grass

The method iterates over the list of blocks to make the integer list, and then iterates over the list in the same way to convert back.

See: https://github.com/Direwolf20-MC/BuildingGadgets2/blob/main/src/main/java/com/direwolf20/buildinggadgets2/common/worlddata/BG2Data.java#L111

{
"name": "",
"statePosArrayList": "{blockstatemap:[{Name:"minecraft:grass_block",Properties:{snowy:"false"}},{Name:"minecraft:air"},{Name:"occultism:storage_controller"},{Name:"occultism:storage_controller_base"},{Name:"minecraft:grass"}],endpos:{X:0,Y:1,Z:5},startpos:{X:-2,Y:0,Z:0},statelist:[I;0,0,0,1,1,1,1,0,0,1,1,2,3,1,0,1,1,1,1,0,0,1,4,4,4,0,0,1,1,1,0,0,0,4,4,1]}",
"requiredItems": {
"occultism:storage_controller_base": 1,
"minecraft:grass": 5,
"minecraft:grass_block": 13,
"occultism:storage_controller": 1
}
}