Initial commit
This commit is contained in:
66
include/MapBlock.h
Normal file
66
include/MapBlock.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef MAPBLOCK_H
|
||||
#define MAPBLOCK_H
|
||||
#include <cstdio>
|
||||
#include "Base.h"
|
||||
|
||||
|
||||
class NodeManager
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
NodeManager()
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~NodeManager()
|
||||
{
|
||||
|
||||
}
|
||||
//8191
|
||||
void printMapBlock()
|
||||
{
|
||||
for(int i = 0; i < 10536; i++)
|
||||
{
|
||||
printf("\n[%i] %i", i, mapBlock[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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 Block
|
||||
{
|
||||
public:
|
||||
Block(int x, int z)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int getBlockFromNodeCoordinates(int x, int z)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user