Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

https://minecraft.fandom.com/wiki/Anvil_file_format

https://minecraft.fandom.com/wiki/Chunk_format

The main unit of minecraft storage is the chunk, which is a 16x16xWorld height area of the map. Chunks are bundled into groups of 32x32 chunks for storage on disk. Minecraft keeps a map of chunks for an area of (configured render distance + 3) chunks in memory, and pages these in and out as you move around (including generating new chunks if you reach a chunk that's never been generated before).

Chunks themselves are subdivided into 16x16x16 sections of blocks by vertical height.

So the process is:

1. Find chunk containing co-ordinate (maths + dict lookup) 2. Find array containing data based on y co-ordinate (basically an array lookup) 3. Find block in array (another array lookup)

There's also various data of more variable size (e.g. lists of entities, structures, etc.) tacked onto the chunk format. These tend to be much smaller in number for any given chunk, so my understanding is these are basically just linearly searched or iterated on a per chunk basis when required.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: