mcedit/pymclevel — Issue #78: Full Anvil support: Chunk Sections, AddBlocks
Author: codewarrior0
Created: 2012-03-04 04:40:45+00:00
State: open

The current support for Minecraft 1.2 (Anvil) format worlds is incomplete, slow, and inefficient. It emulates the older vertical chunks by combining the Chunk Sections into 16x16x256 chunks, then splitting them back again when the level is saved.

Currently, all of the editing functions (copyBlocks, fillBlocks, and MCEdit's Brush, Fill, and Filter tools, plus the "Remove All Items" function on the chest editor) depend on the chunks being stored as a set of 16x16xH byte arrays (Blocks, plus Data for any format except Classic; the other arrays Light and SkyLight should be handled transparently by the lighting functions). To support Anvil's array of 16x16x16 Chunk Sections, all of these should be changed to expect a chunk having a Sections array.

Ideally, we should be able to do everything using functions like `world.getBlock` and `world.setBlock` to access the world one block at a time, but this was found to be too slow when running in pure Python. Instead, I chose to write the editing functions in terms of the byte arrays and tag structures that make up the storage format, making them intimately linked to that format. It was easy enough to make the older non-chunked formats present an interface exactly like the newer (at the time) Infdev format by using numpy's awesome array slicing and axis swapping powers. It should be just as easy to make them present an interface with Chunk Sections instead of solid vertical chunks.

Changing the chunk interface will break any clients of pymclevel. It may be possible to preserve the old interface by combining the Chunk Sections into a vertical chunk only as required when chunk.Blocks is accessed.

[xxx AddBlocks]