XtreemNodes/include/MapBlock.h

75 lines
1.0 KiB
C++

#ifndef MAPBLOCK_H
#define MAPBLOCK_H
#include "Base.h"
#include <math.h>
class NodeManager
{
public:
int blockX;
int blockZ;
NodeManager(int x, int z)
{
}
virtual ~NodeManager()
{
}
void addNode(int id, int meta, int x, int y, int z)
{
mapBlock[256 * y + z * 16 + x] = id;
}
bool isAir(int x, int y, int z)
{
return getNodeAt(x, y, z) == 0;
}
int getNodeAt(int x, int y, int z)
{
return x < 16 && z < 16 && x >= 0 && z >= 0 ? mapBlock[256 * y + z * 16 + x] : 0;
}
protected:
private:
int mapBlock[65536];
};
class BlockManager
{
};
class BlockUtilities
{
public:
BlockUtilities()
{
}
static Position2D getBlockFromNodeCoordinates(int x, int z)
{
Position2D pos2d;
pos2d.x = floor(x / 16);
pos2d.z = floor(z / 16);
return pos2d;
}
};
#endif