I assume that you probably wonβt need to have all the possible area of ββthe Minecraft world during your memory, because that would be incredibly huge (1024000000 KM ^ 2). If you are just trying to keep an area in which someone would normally visit while playing a game in memory, I think it would be entirely possible to access it using STL (the standard template library).
Minecraft mines are always loaded into the game in pieces that are 16X16X255 blocks. You can store chunks in your program in std::map . There are several advantages to this. Firstly, it allows you to display locations well above the playing area of ββa map based on a wiki entry for Far Lands . It also allows a rare view of the minecraft map, which is very close to how real Minecraft maps are displayed. Only those pieces that you use for your program are loaded into std::map and, I hope, it is wise to use memory. You could represent any area regardless of its location in the playing area of ββthe total possible area of ββthe Minecraft map.
To implement this, you just need to first create a world data type:
using namespace std; struct Block {
Then to access one block:
Block McMap::getBlock(int x, short y, int z) { const int WIDTH = 16; // You might want to store these constants elsewhere const int HEIGHT = 255; int chunkx = x / WIDTH; int chunkz = z / WIDTH; return yourWorld[chunkx][chunkz][x + z * WIDTH + y * HEIGHT * WIDTH]; }
To erase a fragment:
void McMap::eraseChunk(int x, int z) { if (yourWorld.find(x))
Another advantage of using this method is that by creating a smart constructor for a piece, and not just using a typdedef like me, you could automatically generate a fragment when you need to access a new fragment in the std::map world, like how pieces are generated in Minecraft only when they are visited. Whenever you access an object that does not yet exist on the map, it will call the default constructor for that object.
Danny source share