Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Nice! Finally the code is getting pretty again. I knew it could be done with templates, but was too lazy to try do it myself. Congratulations.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Because why bother? I'll be the only one using this tool regularly, anyway. Using a toolkit would mean I'd first have to learn that, that's too much of an investment for a minor task like this.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
So, I'd like to add a few things to the API, so that plugins can be made more powerful. For starters, I think some generator injecting could be useful, so that plugins may enhance the generated world using the OnChunkGenerating() or OnChunkGenerated() hooks. But for that to work, two things are essential:
- cChunkDesc must be able to have a cBlockArea written to it
- cBlockArea needs file IO, so that "models" can be loaded and saved from files
Also, useful stuff:
- cBlockArea:Crop() to crop along either of the axes
- cBlockArea:Expand() to expand itself in either of the axes
- cBlockArea:RotateCW() and RotateCCW() to rotate by 90 degrees along the vertical axis
- cBlockArea:MirrorX(), MirrorY(), MirrorZ() to mirror by the specified axis
I started by cBlockArea:Crop(), just to get the feel of the things. And I discovered quite a nasty bug in cBlockArea::MakeIndex that could have caused weird memory overwrite bugs.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Whew, .schematic file support was a pain. But it's half-done now. Loading works and is also exported as an API to the plugins as the cBlockArea:LoadFromSchematicFile() function.
One thing I've noticed, though - if there are many block changes per chunk (hundreds), MineCraft really stops to a crawl if we send it via a MultiBlockChange packet. We should probably detect this and send the entire chunk anew instead. I tried inserting a 200x170x200 block schematic and the client just froze, I had to kill it.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Writing .schematic files is done.
Note, though, that only block types and block metas are saved. Neither then Entities nor the BlockEntities (or in schematic-speak, TileEntities) are saved, meaning that signs will be blank, chest will lose their contents etc. I don't think I'll be adding support for that anytime soon, unless there's an uproar of plugin authors wanting to use it.
Posts: 313
Threads: 32
Joined: Feb 2012
Thanks: 98
Given 14 thank(s) in 13 post(s)
I thought about making a plugin for saving, loading and pasting areas myself :-D but this is so much better! I'll look into this, could be fun to mess around, making wells and towers and whatsoever :-) as soon as I'm back from Moscow