cuberite / WorldEdit

WorldEdit plugin for Cuberite
https://cuberite.org/
Apache License 2.0
42 stars 18 forks source link

Cubeset export #154

Closed NiLSPACE closed 1 year ago

NiLSPACE commented 1 year ago

This makes it possible to save your clipboard to the Cubeset format so Cuberite's SinglePieceStructures generator can use it to generate custom structures. By default the //schematic save command still uses the mcedit (.schematic) format.

Saving

In order to save with the Cubeset format you have to specify that in the command:

//schematic save cubeset myfile

If you want to override certain settings, like the biomes in which the structure should generate or the size of the grid used to spread out the structure then it's possible to add those options at the end of the command.

//schematic save cubeset myfile AllowedBiomes=Ocean,DeepOcean GridSize=500

Certain settings are piece specific in the Cubeset format, like how the piece should be placed on the ground. This can be specified by prefixing the setting with piece.. This would look like this:

//schematic save cubeset myfile piece.VerticalStrategy=TerrainOrOceanTop|-2

It's also possible to load structures with multiple pieces like the netherfortress prefabs.

Loading

Loading a cubeset file is the same as the mcedit format. The plugin automatically finds the requested file (though it doesn't notice yet if there are two files with the same name but different extensions). If there are multiple pieces in a cubeset file, for example if you load the NetherFortress cubeset file, then it's possible to specify which piece you want by adding piecenr=<the piece you want>

//schematic load NetherFortress piecenr=6

Using in the world generator

After saving your clipboard to a cubeset file it's possible to load it in the world generator. This is done by copying the file from the schematics folder into Prefabs/SinglePieceStructures and then enabling it in your world's world.ini file. This is done by adding SinglePieceStructures: <CubesetFilename> into your world.ini's Finishers list. 2023-05-04_13 30 20

madmaxoft commented 1 year ago

Great job, this looks really nice. There's just two minor things:

NiLSPACE commented 1 year ago

I'll move the documentation to Info.lua and rename piecenr 👍. I also noticed code from #153 is in here. Did you see my response from that PR?

NiLSPACE commented 1 year ago

This is outside the scope of this PR, but I was wondering if it's possible to provide the cIniFile object of the world.ini file to the LuaState that reads the cubeset files. That way certain settings could be handled inside the world.ini instead of being fixed for every world.

NiLSPACE commented 1 year ago

Oh, I didn't even notice that I was mixing them. I've removed them from this PR now, but I did notice there are other places where they are still used. I've created an issue for that: #155