Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <ChunkDesc.h>
Public Types | |
typedef NIBBLETYPE | BlockNibbleBytes[cChunkDef::NumBlocks] |
Uncompressed block metas, 1 meta per byte. More... | |
typedef Byte | Shape[256 *16 *16] |
The datatype used to represent the entire chunk worth of shape. More... | |
Public Member Functions | |
cChunkDesc (cChunkCoords a_Coords) | |
void | CompressBlockMetas (cChunkDef::BlockNibbles &a_DestMetas) |
Compresses the metas from the BlockArea format (1 meta per byte) into regular format (2 metas per byte) More... | |
void | FillBlocks (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
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. More... | |
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. More... | |
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, water); allows cuboid out of range of this chunk. More... | |
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, water); allows cuboid out of range of this chunk. More... | |
EMCSBiome | GetBiome (int a_RelX, int a_RelZ) const |
const cChunkDef::BiomeMap & | GetBiomeMap () const |
cChunkDef::BiomeMap & | GetBiomeMap (void) |
cBlockEntities & | GetBlockEntities (void) |
cBlockEntity * | GetBlockEntity (int a_RelX, int a_RelY, int a_RelZ) |
Returns the block entity at the specified coords. More... | |
NIBBLETYPE | GetBlockMeta (int a_RelX, int a_RelY, int a_RelZ) const |
BlockNibbleBytes & | GetBlockMetasUncompressed (void) |
BLOCKTYPE | GetBlockType (int a_RelX, int a_RelY, int a_RelZ) const |
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. More... | |
const cChunkDef::BlockTypes & | GetBlockTypes () const |
cChunkDef::BlockTypes & | GetBlockTypes (void) |
cChunkCoords | GetChunkCoords () const |
int | GetChunkX () const |
int | GetChunkZ () const |
cEntityList & | GetEntities (void) |
HEIGHTTYPE | GetHeight (int a_RelX, int a_RelZ) const |
const cChunkDef::HeightMap & | GetHeightMap () const |
cChunkDef::HeightMap & | GetHeightMap (void) |
HEIGHTTYPE | GetMaxHeight (void) const |
Returns the maximum height value in the heightmap. More... | |
HEIGHTTYPE | GetMinHeight (void) const |
Returns the minimum height value in the heightmap. More... | |
void | GetShapeFromHeight (Shape &a_Shape) const |
Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap. More... | |
bool | IsUsingDefaultBiomes (void) const |
bool | IsUsingDefaultComposition (void) const |
bool | IsUsingDefaultFinish (void) const |
bool | IsUsingDefaultHeight (void) const |
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 this chunk. More... | |
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 this chunk. More... | |
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. More... | |
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 chunk. More... | |
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 chunk. More... | |
void | SetBiome (int a_RelX, int a_RelZ, EMCSBiome a_BiomeID) |
void | SetBlockMeta (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta) |
void | SetBlockType (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType) |
void | SetBlockTypeMeta (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
void | SetChunkCoords (cChunkCoords a_Coords) |
void | SetHeight (int a_RelX, int a_RelZ, HEIGHTTYPE a_Height) |
void | SetHeightFromShape (const Shape &a_Shape) |
Sets the heightmap to match the given shape data. More... | |
void | SetUseDefaultBiomes (bool a_bUseDefaultBiomes) |
void | SetUseDefaultComposition (bool a_bUseDefaultComposition) |
void | SetUseDefaultFinish (bool a_bUseDefaultFinish) |
void | SetUseDefaultHeight (bool a_bUseDefaultHeight) |
void | UpdateHeightmap (void) |
Updates the heightmap to match the current contents. More... | |
void | VerifyHeightmap (void) |
Verifies that the heightmap corresponds to blocktype contents; if not, asserts on that column. More... | |
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. More... | |
~cChunkDesc () | |
Static Public Member Functions | |
static bool | GetShapeIsSolidAt (const Shape &a_Shape, int a_X, int a_Y, int a_Z) |
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. More... | |
static void | SetShapeIsSolidAt (Shape &a_Shape, int a_X, int a_Y, int a_Z, bool a_IsSolid) |
Definition at line 27 of file ChunkDesc.h.
typedef NIBBLETYPE cChunkDesc::BlockNibbleBytes[cChunkDef::NumBlocks] |
Uncompressed block metas, 1 meta per byte.
Definition at line 39 of file ChunkDesc.h.
typedef Byte cChunkDesc::Shape[256 *16 *16] |
The datatype used to represent the entire chunk worth of shape.
0 = air 1 = solid Indexed as [y + 256 * x + 256 * 16 * z].
Definition at line 36 of file ChunkDesc.h.
cChunkDesc::cChunkDesc | ( | cChunkCoords | a_Coords | ) |
Definition at line 16 of file ChunkDesc.cpp.
cChunkDesc::~cChunkDesc | ( | ) |
Definition at line 36 of file ChunkDesc.cpp.
void cChunkDesc::CompressBlockMetas | ( | cChunkDef::BlockNibbles & | a_DestMetas | ) |
Compresses the metas from the BlockArea format (1 meta per byte) into regular format (2 metas per byte)
Definition at line 637 of file ChunkDesc.cpp.
void cChunkDesc::FillBlocks | ( | BLOCKTYPE | a_BlockType, |
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 54 of file ChunkDesc.cpp.
|
inline |
Fills the relative cuboid with specified block; allows cuboid out of range of this chunk.
Definition at line 141 of file ChunkDesc.h.
void cChunkDesc::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.
Definition at line 431 of file ChunkDesc.cpp.
|
inline |
Replaces the blocks in the cuboid by the dst blocks if they are considered non-floor (air, water); allows cuboid out of range of this chunk.
Definition at line 185 of file ChunkDesc.h.
void cChunkDesc::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, water); allows cuboid out of range of this chunk.
Definition at line 498 of file ChunkDesc.cpp.
EMCSBiome cChunkDesc::GetBiome | ( | int | a_RelX, |
int | a_RelZ | ||
) | const |
Definition at line 126 of file ChunkDesc.cpp.
|
inline |
Definition at line 243 of file ChunkDesc.h.
|
inline |
Definition at line 234 of file ChunkDesc.h.
|
inline |
Definition at line 241 of file ChunkDesc.h.
cBlockEntity * cChunkDesc::GetBlockEntity | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) |
Returns the block entity at the specified coords.
If there is no block entity at those coords, tries to create one, based on the block type If the blocktype doesn't support a block entity, returns nullptr.
Definition at line 573 of file ChunkDesc.cpp.
NIBBLETYPE cChunkDesc::GetBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 99 of file ChunkDesc.cpp.
|
inline |
Definition at line 238 of file ChunkDesc.h.
BLOCKTYPE cChunkDesc::GetBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 90 of file ChunkDesc.cpp.
void cChunkDesc::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.
Exported to Lua manually to avoid extra parameters generated by ToLua++.
Definition at line 72 of file ChunkDesc.cpp.
|
inline |
Definition at line 244 of file ChunkDesc.h.
|
inline |
Definition at line 235 of file ChunkDesc.h.
|
inline |
Definition at line 54 of file ChunkDesc.h.
|
inline |
Definition at line 49 of file ChunkDesc.h.
|
inline |
Definition at line 50 of file ChunkDesc.h.
|
inline |
Definition at line 240 of file ChunkDesc.h.
HEIGHTTYPE cChunkDesc::GetHeight | ( | int | a_RelX, |
int | a_RelZ | ||
) | const |
Definition at line 144 of file ChunkDesc.cpp.
|
inline |
Definition at line 245 of file ChunkDesc.h.
|
inline |
Definition at line 239 of file ChunkDesc.h.
HEIGHTTYPE cChunkDesc::GetMaxHeight | ( | void | ) | const |
Returns the maximum height value in the heightmap.
Definition at line 397 of file ChunkDesc.cpp.
HEIGHTTYPE cChunkDesc::GetMinHeight | ( | void | ) | const |
Returns the minimum height value in the heightmap.
Definition at line 414 of file ChunkDesc.cpp.
void cChunkDesc::GetShapeFromHeight | ( | Shape & | a_Shape | ) | const |
Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap.
Definition at line 175 of file ChunkDesc.cpp.
|
inlinestatic |
Definition at line 102 of file ChunkDesc.h.
bool cChunkDesc::IsUsingDefaultBiomes | ( | void | ) | const |
Definition at line 208 of file ChunkDesc.cpp.
bool cChunkDesc::IsUsingDefaultComposition | ( | void | ) | const |
Definition at line 244 of file ChunkDesc.cpp.
bool cChunkDesc::IsUsingDefaultFinish | ( | void | ) | const |
Definition at line 262 of file ChunkDesc.cpp.
bool cChunkDesc::IsUsingDefaultHeight | ( | void | ) | const |
Definition at line 226 of file ChunkDesc.cpp.
|
inlinestatic |
Returns the index into the internal shape array for the specified coords.
Definition at line 91 of file ChunkDesc.h.
|
inline |
Fills the relative cuboid with specified block with a random chance; allows cuboid out of range of this chunk.
Definition at line 208 of file ChunkDesc.h.
void cChunkDesc::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 this chunk.
Definition at line 537 of file ChunkDesc.cpp.
void cChunkDesc::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.
Definition at line 280 of file ChunkDesc.cpp.
|
inline |
Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this chunk.
Definition at line 161 of file ChunkDesc.h.
void cChunkDesc::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 chunk.
Definition at line 461 of file ChunkDesc.cpp.
void cChunkDesc::SetBiome | ( | int | a_RelX, |
int | a_RelZ, | ||
EMCSBiome | a_BiomeID | ||
) |
Definition at line 117 of file ChunkDesc.cpp.
void cChunkDesc::SetBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 108 of file ChunkDesc.cpp.
void cChunkDesc::SetBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 81 of file ChunkDesc.cpp.
void cChunkDesc::SetBlockTypeMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 63 of file ChunkDesc.cpp.
void cChunkDesc::SetChunkCoords | ( | cChunkCoords | a_Coords | ) |
Definition at line 45 of file ChunkDesc.cpp.
void cChunkDesc::SetHeight | ( | int | a_RelX, |
int | a_RelZ, | ||
HEIGHTTYPE | a_Height | ||
) |
Definition at line 135 of file ChunkDesc.cpp.
void cChunkDesc::SetHeightFromShape | ( | const Shape & | a_Shape | ) |
Sets the heightmap to match the given shape data.
Note that this ignores overhangs; the method is mostly used by old composition generators.
Definition at line 153 of file ChunkDesc.cpp.
|
inlinestatic |
Definition at line 96 of file ChunkDesc.h.
void cChunkDesc::SetUseDefaultBiomes | ( | bool | a_bUseDefaultBiomes | ) |
Definition at line 199 of file ChunkDesc.cpp.
void cChunkDesc::SetUseDefaultComposition | ( | bool | a_bUseDefaultComposition | ) |
Definition at line 235 of file ChunkDesc.cpp.
void cChunkDesc::SetUseDefaultFinish | ( | bool | a_bUseDefaultFinish | ) |
Definition at line 253 of file ChunkDesc.cpp.
void cChunkDesc::SetUseDefaultHeight | ( | bool | a_bUseDefaultHeight | ) |
Definition at line 217 of file ChunkDesc.cpp.
void cChunkDesc::UpdateHeightmap | ( | void | ) |
Updates the heightmap to match the current contents.
Useful for plugins when writing custom block areas into the chunk
Definition at line 612 of file ChunkDesc.cpp.
void cChunkDesc::VerifyHeightmap | ( | void | ) |
Verifies that the heightmap corresponds to blocktype contents; if not, asserts on that column.
Definition at line 652 of file ChunkDesc.cpp.
void cChunkDesc::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.
Area's data overwrite everything in the chunk.
Definition at line 271 of file ChunkDesc.cpp.
|
private |
Definition at line 258 of file ChunkDesc.h.
|
private |
Definition at line 259 of file ChunkDesc.h.
|
private |
Definition at line 262 of file ChunkDesc.h.
|
private |
Definition at line 264 of file ChunkDesc.h.
|
private |
Definition at line 266 of file ChunkDesc.h.
|
private |
Definition at line 267 of file ChunkDesc.h.
|
private |
Definition at line 265 of file ChunkDesc.h.
|
private |
Definition at line 256 of file ChunkDesc.h.
|
private |
Definition at line 261 of file ChunkDesc.h.
|
private |
Definition at line 260 of file ChunkDesc.h.