How is world data stored in Minecraft? [closed]

Solution 1:

There is not 130 quadrillion blocks in a typical world save. The world is generated as needed and only the areas that are generated are saved. This means you are only saving a handful of chunks. A chunk in Minecraft is an area 16 x 16 x world height blocks in size (currently 65536 blocks, previously 32768).

Solution 2:

The entire world is generated using seed values. Only user modified block data is stored as well as the seed. In my engine, I have what's called a region. It is composed of 16x16x16 chunks which are 16x16x16 cubes. 4096 cubes per chunk, 4096 chunks per region. An algorithm determines which faces of the cubes are visible and adds them to a vertex buffer. Only chunks within view are built. To generate an endless world chunks are recycled and built as you move. The number of chunks never changes. Cubes are stored as a byte array allowing you to have 255 block types. No other data is stored since face normals and other things are done programatically. A perlin noise and perlin worm algorithm are used to generate new world data as you move using the seed values. Hope this helps someone.

Solution 3:

Technically air does not exist, therefore the block data for air is stored as false or null, meaning Minecraft does not have to generate anything allowing for the file size to be much smaller. And as other people have said before, only the chunks you see are loaded, but that's not entirely true. Spawn chunks are always loaded therefore always saved, the rest is just compressed then saved.