![]() |
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 (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 | 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 | 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... | |
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... | |
EMCSBiome | GetBiome (int a_RelX, int a_RelZ) const |
cChunkDef::BiomeMap & | GetBiomeMap (void) |
const cChunkDef::BiomeMap & | GetBiomeMap () const |
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... | |
cChunkDef::BlockTypes & | GetBlockTypes (void) |
const cChunkDef::BlockTypes & | GetBlockTypes () const |
cChunkCoords | GetChunkCoords () const |
int | GetChunkX () const |
int | GetChunkZ () const |
cEntityList & | GetEntities (void) |
HEIGHTTYPE | GetHeight (int a_RelX, int a_RelZ) const |
cChunkDef::HeightMap & | GetHeightMap (void) |
const cChunkDef::HeightMap & | GetHeightMap () const |
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 (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 | 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 | 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 (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 | 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 | 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 | 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 () | |
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.
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 |
Fills the relative cuboid with specified block; allows cuboid out of range of this chunk.
Definition at line 123 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.
|
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 167 of file ChunkDesc.h.
EMCSBiome cChunkDesc::GetBiome | ( | int | a_RelX, |
int | a_RelZ | ||
) | const |
Definition at line 126 of file ChunkDesc.cpp.
|
inline |
Definition at line 216 of file ChunkDesc.h.
|
inline |
Definition at line 225 of file ChunkDesc.h.
|
inline |
Definition at line 223 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 220 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 217 of file ChunkDesc.h.
|
inline |
Definition at line 226 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 222 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 221 of file ChunkDesc.h.
|
inline |
Definition at line 227 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.
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.
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.
|
inline |
Fills the relative cuboid with specified block with a random chance; allows cuboid out of range of this chunk.
Definition at line 190 of file ChunkDesc.h.
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.
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.
|
inline |
Replaces the specified src blocks in the cuboid by the dst blocks; allows cuboid out of range of this chunk.
Definition at line 143 of file ChunkDesc.h.
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.
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::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 240 of file ChunkDesc.h.
|
private |
Definition at line 241 of file ChunkDesc.h.
|
private |
Definition at line 244 of file ChunkDesc.h.
|
private |
Definition at line 246 of file ChunkDesc.h.
|
private |
Definition at line 248 of file ChunkDesc.h.
|
private |
Definition at line 249 of file ChunkDesc.h.
|
private |
Definition at line 247 of file ChunkDesc.h.
|
private |
Definition at line 238 of file ChunkDesc.h.
|
private |
Definition at line 243 of file ChunkDesc.h.
|
private |
Definition at line 242 of file ChunkDesc.h.