twoolie / NBT

Python Parser/Writer for the NBT file format, and it's container the RegionFile.
MIT License
361 stars 74 forks source link

Setting a block should update light levels #24

Open macfreek opened 12 years ago

macfreek commented 12 years ago

nbt.chunk is capable of settings blocks, but does not update the light levels in the nbt file as well.

Edit: I consider this a small issue, and perhaps it should not be implemented by the NBT library, as it is very Minecraft specific, and applications that use NBT can implement this as well.

twoolie commented 12 years ago

Chunk is minecraft specific. This should be included as a function that can be callled when the block is finalized

macfreek commented 12 years ago

I propose to make the functions that update the heightmap and lightlevel (#24) callback functions. Chunk is mostly a wrapper to simplify access to the NBT data structure. However, these functions add more logic and need additional information. In this case about light emission from certain blocks.

By making them callback functions instead of methods in Chunk, it is easier to update them with a more sophisticated method later (e.g. taking into account if a light switch is on or off), or have tools that rely on the NBT library override them. I'll make a proposal.