12 #include "../BlockArea.h"
13 #include "../Cuboid.h"
99 a_Shape[index] = a_IsSolid ? 1 : 0;
105 return a_Shape[index];
124 void ReadBlockArea(
cBlockArea & a_Dest,
int a_MinRelX,
int a_MaxRelX,
int a_MinRelY,
int a_MaxRelY,
int a_MinRelZ,
int a_MaxRelZ);
134 int a_MinX,
int a_MaxX,
135 int a_MinY,
int a_MaxY,
136 int a_MinZ,
int a_MaxZ,
144 a_RelCuboid.
p1.
x, a_RelCuboid.
p2.
x,
145 a_RelCuboid.
p1.
y, a_RelCuboid.
p2.
y,
146 a_RelCuboid.
p1.
z, a_RelCuboid.
p2.
z,
147 a_BlockType, a_BlockMeta
153 int a_MinX,
int a_MaxX,
154 int a_MinY,
int a_MaxY,
155 int a_MinZ,
int a_MaxZ,
168 a_RelCuboid.
p1.
x, a_RelCuboid.
p2.
x,
169 a_RelCuboid.
p1.
y, a_RelCuboid.
p2.
y,
170 a_RelCuboid.
p1.
z, a_RelCuboid.
p2.
z,
171 a_SrcType, a_SrcMeta,
178 int a_MinX,
int a_MaxX,
179 int a_MinY,
int a_MaxY,
180 int a_MinZ,
int a_MaxZ,
191 a_RelCuboid.
p1.
x, a_RelCuboid.
p2.
x,
192 a_RelCuboid.
p1.
y, a_RelCuboid.
p2.
y,
193 a_RelCuboid.
p1.
z, a_RelCuboid.
p2.
z,
200 int a_MinX,
int a_MaxX,
201 int a_MinY,
int a_MaxY,
202 int a_MinZ,
int a_MaxZ,
204 int a_RandomSeed,
int a_ChanceOutOf10k
210 int a_RandomSeed,
int a_ChanceOutOf10k
214 a_RelCuboid.
p1.
x, a_RelCuboid.
p2.
x,
215 a_RelCuboid.
p1.
y, a_RelCuboid.
p2.
y,
216 a_RelCuboid.
p1.
z, a_RelCuboid.
p2.
z,
217 a_BlockType, a_BlockMeta,
218 a_RandomSeed, a_ChanceOutOf10k
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char HEIGHTTYPE
The type used by the heightmap.
std::vector< OwnedEntity > cEntityList
unsigned char BLOCKTYPE
The datatype used by blockdata.
NIBBLETYPE * GetBlockMetas(void) const
BLOCKTYPE * GetBlockTypes(void) const
Returns the internal pointer to the block types.
eMergeStrategy
The per-block strategy to use when merging another block area into this object.
Wraps the chunk coords into a single structure.
BLOCKTYPE BlockTypes[NumBlocks]
The type used for block type operations and storage, AXIS_ORDER ordering.
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
NIBBLETYPE BlockNibbles[NumBlocks/2]
The type used for block data in nibble format, AXIS_ORDER ordering.
static const int NumBlocks
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
HEIGHTTYPE GetHeight(int a_RelX, int a_RelZ) const
void ReadBlockArea(cBlockArea &a_Dest, int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ)
Reads an area from the chunk into a cBlockArea, blocktypes and blockmetas.
static size_t MakeShapeIndex(int a_X, int a_Y, int a_Z)
Returns the index into the internal shape array for the specified coords.
bool IsUsingDefaultHeight(void) const
const cChunkDef::BiomeMap & GetBiomeMap() const
EMCSBiome GetBiome(int a_RelX, int a_RelZ) const
cBlockEntity * GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
Returns the block entity at the specified coords.
void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
void FloorRelCuboid(const cCuboid &a_RelCuboid, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air,...
bool IsUsingDefaultBiomes(void) const
void RandomFillRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_RandomSeed, int a_ChanceOutOf10k)
Fills the relative cuboid with specified block with a random chance; allows cuboid out of range of th...
cEntityList & GetEntities(void)
Byte Shape[256 *16 *16]
The datatype used to represent the entire chunk worth of shape.
const cChunkDef::HeightMap & GetHeightMap() const
void SetUseDefaultBiomes(bool a_bUseDefaultBiomes)
void SetUseDefaultHeight(bool a_bUseDefaultHeight)
void FillRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Fills the relative cuboid with specified block; allows cuboid out of range of this chunk.
static void SetShapeIsSolidAt(Shape &a_Shape, int a_X, int a_Y, int a_Z, bool a_IsSolid)
void SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height)
void SetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
cChunkDef::BlockTypes & GetBlockTypes(void)
bool IsUsingDefaultFinish(void) const
static bool GetShapeIsSolidAt(const Shape &a_Shape, int a_X, int a_Y, int a_Z)
void SetUseDefaultComposition(bool a_bUseDefaultComposition)
void SetChunkCoords(cChunkCoords a_Coords)
void SetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta)
cBlockEntities & GetBlockEntities(void)
void CompressBlockMetas(cChunkDef::BlockNibbles &a_DestMetas)
Compresses the metas from the BlockArea format (1 meta per byte) into regular format (2 metas per byt...
cChunkDef::HeightMap & GetHeightMap(void)
BlockNibbleBytes & GetBlockMetasUncompressed(void)
NIBBLETYPE GetBlockMeta(int a_RelX, int a_RelY, int a_RelZ) const
void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
cChunkDef::BiomeMap m_BiomeMap
void SetUseDefaultFinish(bool a_bUseDefaultFinish)
void FloorRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air,...
bool m_bUseDefaultComposition
void ReplaceRelCuboid(const cCuboid &a_RelCuboid, BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this...
void FillRelCuboid(const cCuboid &a_RelCuboid, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Fills the relative cuboid with specified block; allows cuboid out of range of this chunk.
void VerifyHeightmap(void)
Verifies that the heightmap corresponds to blocktype contents; if not, asserts on that column.
void ReplaceRelCuboid(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ, BLOCKTYPE a_SrcType, NIBBLETYPE a_SrcMeta, BLOCKTYPE a_DstType, NIBBLETYPE a_DstMeta)
Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this...
cBlockEntities m_BlockEntities
void RandomFillRelCuboid(const cCuboid &a_RelCuboid, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_RandomSeed, int a_ChanceOutOf10k)
Fills the relative cuboid with specified block with a random chance; allows cuboid out of range of th...
HEIGHTTYPE GetMinHeight(void) const
Returns the minimum height value in the heightmap.
void GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Returns the BlockType and BlockMeta at the specified coords.
void GetShapeFromHeight(Shape &a_Shape) const
Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap.
bool IsUsingDefaultComposition(void) const
BLOCKTYPE GetBlockType(int a_RelX, int a_RelY, int a_RelZ) const
const cChunkDef::BlockTypes & GetBlockTypes() const
void SetBiome(int a_RelX, int a_RelZ, EMCSBiome a_BiomeID)
void WriteBlockArea(const cBlockArea &a_BlockArea, int a_RelX, int a_RelY, int a_RelZ, cBlockArea::eMergeStrategy a_MergeStrategy=cBlockArea::msOverwrite)
Writes the block area into the chunk, with its origin set at the specified relative coords.
cChunkCoords GetChunkCoords() const
cChunkDef::HeightMap m_HeightMap
cChunkDef::BiomeMap & GetBiomeMap(void)
NIBBLETYPE BlockNibbleBytes[cChunkDef::NumBlocks]
Uncompressed block metas, 1 meta per byte.
void UpdateHeightmap(void)
Updates the heightmap to match the current contents.
void SetHeightFromShape(const Shape &a_Shape)
Sets the heightmap to match the given shape data.
HEIGHTTYPE GetMaxHeight(void) const
Returns the maximum height value in the heightmap.
cChunkDesc(cChunkCoords a_Coords)
std::unordered_map< size_t, OwnedBlockEntity > cBlockEntities