Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <BlockArea.h>
Classes | |
class | cChunkReader |
Public Types | |
enum | { baTypes = 1 , baMetas = 2 , baLight = 4 , baSkyLight = 8 , baBlockEntities = 32 } |
What data is to be queried (bit-mask) More... | |
enum | eMergeStrategy { msOverwrite , msFillAir , msImprint , msLake , msSpongePrint , msDifference , msSimpleCompare , msMask } |
The per-block strategy to use when merging another block area into this object. More... | |
Public Member Functions | |
cBlockArea (void) | |
void | Clear (void) |
Clears the data stored to reclaim memory. More... | |
void | CopyFrom (const cBlockArea &a_From) |
Copies the contents from the specified BlockArea into this object. More... | |
void | CopyTo (cBlockArea &a_Into) const |
Copies this object's contents into the specified BlockArea. More... | |
size_t | CountNonAirBlocks (void) const |
Returns the count of blocks that are not air. More... | |
size_t | CountSpecificBlocks (BLOCKTYPE a_BlockType) const |
Returns how many times the specified block is contained in the area. More... | |
size_t | CountSpecificBlocks (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const |
Returns how many times the specified block is contained in the area. More... | |
void | Create (const Vector3i &a_Size, int a_DataTypes=baTypes|baMetas|baBlockEntities) |
Creates a new area of the specified size and contents. More... | |
void | Create (int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes=baTypes|baMetas|baBlockEntities) |
Creates a new area of the specified size and contents. More... | |
void | Crop (int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ) |
Crops the internal contents by the specified amount of blocks from each border. More... | |
bool | DoWithBlockEntityAt (int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback a_Callback) |
Calls the callback for the block entity at the specified coords. More... | |
bool | DoWithBlockEntityRelAt (int a_RelX, int a_RelY, int a_RelZ, cBlockEntityCallback a_Callback) |
Calls the callback for the block entity at the specified coords. More... | |
void | DumpToRawFile (const AString &a_FileName) |
For testing purposes only, dumps the area into a file. More... | |
void | Expand (int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ) |
Expands the internal contents by the specified amount of blocks from each border. More... | |
void | Fill (int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta=0, NIBBLETYPE a_BlockLight=0, NIBBLETYPE a_BlockSkyLight=0x0f) |
Fills the entire block area with the specified data. More... | |
void | FillRelCuboid (const cCuboid &a_RelCuboid, int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta=0, NIBBLETYPE a_BlockLight=0, NIBBLETYPE a_BlockSkyLight=0x0f) |
Fills a cuboid inside the block area with the specified data. More... | |
void | FillRelCuboid (int a_MinRelX, int a_MaxRelX, int a_MinRelY, int a_MaxRelY, int a_MinRelZ, int a_MaxRelZ, int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta=0, NIBBLETYPE a_BlockLight=0, NIBBLETYPE a_BlockSkyLight=0x0f) |
Fills a cuboid inside the block area with the specified data. More... | |
bool | ForEachBlockEntity (cBlockEntityCallback a_Callback) |
Calls the callback for all the block entities. More... | |
size_t | GetBlockCount (void) const |
const cBlockEntities & | GetBlockEntities (void) const |
Direct read-only access to block entities. More... | |
NIBBLETYPE | GetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ) const |
NIBBLETYPE * | GetBlockLight (void) const |
NIBBLETYPE | GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ) const |
NIBBLETYPE * | GetBlockMetas (void) const |
NIBBLETYPE | GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ) const |
NIBBLETYPE * | GetBlockSkyLight (void) const |
BLOCKTYPE | GetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ) const |
void | GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const |
BLOCKTYPE * | GetBlockTypes (void) const |
Returns the internal pointer to the block types. More... | |
cCuboid | GetBounds (void) const |
int | GetDataTypes (void) const |
Returns the datatypes that are stored in the object (bitmask of baXXX values) More... | |
void | GetNonAirCropRelCoords (int &a_MinRelX, int &a_MinRelY, int &a_MinRelZ, int &a_MaxRelX, int &a_MaxRelY, int &a_MaxRelZ, BLOCKTYPE a_IgnoreBlockType=E_BLOCK_AIR) |
Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction. More... | |
const Vector3i & | GetOrigin (void) const |
int | GetOriginX (void) const |
int | GetOriginY (void) const |
int | GetOriginZ (void) const |
NIBBLETYPE | GetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ) const |
NIBBLETYPE | GetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ) const |
NIBBLETYPE | GetRelBlockSkyLight (int a_RelX, int a_RelY, int a_RelZ) const |
BLOCKTYPE | GetRelBlockType (int a_RelX, int a_RelY, int a_RelZ) const |
void | GetRelBlockTypeMeta (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const |
const Vector3i & | GetSize (void) const |
int | GetSizeX (void) const |
int | GetSizeY (void) const |
int | GetSizeZ (void) const |
int | GetVolume (void) const |
Returns the volume of the area, as number of blocks. More... | |
const Vector3i & | GetWEOffset (void) const |
bool | HasBlockEntities (void) const |
bool | HasBlockLights (void) const |
bool | HasBlockMetas (void) const |
bool | HasBlockSkyLights (void) const |
bool | HasBlockTypes (void) const |
bool | IsValidCoords (const Vector3i &a_Coords) const |
Returns true if the specified coords are within this area's coord range (as indicated by m_Origin). More... | |
bool | IsValidCoords (int a_BlockX, int a_BlockY, int a_BlockZ) const |
Returns true if the specified coords are within this area's coord range (as indicated by m_Origin). More... | |
bool | IsValidRelCoords (const Vector3i &a_RelCoords) const |
Returns true if the specified relative coords are within this area's coord range (0 - m_Size). More... | |
bool | IsValidRelCoords (int a_RelX, int a_RelY, int a_RelZ) const |
Returns true if the specified relative coords are within this area's coord range (0 - m_Size). More... | |
size_t | MakeIndex (int a_RelX, int a_RelY, int a_RelZ) const |
OBSOLETE, use the Vector3i-based overload instead. More... | |
size_t | MakeIndex (Vector3i a_RelPos) const |
Returns the index into the internal arrays for the specified coords. More... | |
void | Merge (const cBlockArea &a_Src, const Vector3i &a_RelMinCoords, eMergeStrategy a_Strategy) |
Merges another block area into this one, using the specified block combinating strategy. More... | |
void | Merge (const cBlockArea &a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy) |
Merges another block area into this one, using the specified block combinating strategy This function combines another BlockArea into the current object. More... | |
void | MirrorXY (void) |
Mirrors the entire area around the XY plane. More... | |
void | MirrorXYNoMeta (void) |
Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta. More... | |
void | MirrorXZ (void) |
Mirrors the entire area around the XZ plane. More... | |
void | MirrorXZNoMeta (void) |
Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta. More... | |
void | MirrorYZ (void) |
Mirrors the entire area around the YZ plane. More... | |
void | MirrorYZNoMeta (void) |
Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta. More... | |
bool | Read (cForEachChunkProvider &a_ForEachChunkProvider, const cCuboid &a_Bounds, int a_DataTypes=baTypes|baMetas|baBlockEntities) |
Reads an area of blocks specified. More... | |
bool | Read (cForEachChunkProvider &a_ForEachChunkProvider, const Vector3i &a_Point1, const Vector3i &a_Point2, int a_DataTypes=baTypes|baMetas|baBlockEntities) |
Reads an area of blocks specified. More... | |
bool | Read (cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes=baTypes|baMetas|baBlockEntities) |
Reads an area of blocks specified. More... | |
void | RelLine (const Vector3i &a_Point1, const Vector3i &a_Point2, int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta=0, NIBBLETYPE a_BlockLight=0, NIBBLETYPE a_BlockSkyLight=0x0f) |
Draws a line between two points with the specified data. More... | |
void | RelLine (int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int a_RelY2, int a_RelZ2, int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta=0, NIBBLETYPE a_BlockLight=0, NIBBLETYPE a_BlockSkyLight=0x0f) |
Draws a line between two points with the specified data. More... | |
void | RotateCCW (void) |
Rotates the entire area counter-clockwise around the Y axis. More... | |
void | RotateCCWNoMeta (void) |
Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta. More... | |
void | RotateCW (void) |
Rotates the entire area clockwise around the Y axis. More... | |
void | RotateCWNoMeta (void) |
Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta. More... | |
void | SetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockLight) |
void | SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta) |
void | SetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight) |
void | SetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType) |
void | SetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
void | SetOrigin (const Vector3i &a_Origin) |
Resets the origin. More... | |
void | SetOrigin (int a_OriginX, int a_OriginY, int a_OriginZ) |
Resets the origin. More... | |
void | SetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockLight) |
void | SetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta) |
void | SetRelBlockSkyLight (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockSkyLight) |
void | SetRelBlockType (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType) |
void | SetRelBlockTypeMeta (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) |
void | SetWEOffset (const Vector3i &a_Offset) |
void | SetWEOffset (int a_OffsetX, int a_OffsetY, int a_OffsetZ) |
bool | Write (cForEachChunkProvider &a_ForEachChunkProvider, const Vector3i &a_MinCoords) |
Writes the area back into cWorld at the coords specified. More... | |
bool | Write (cForEachChunkProvider &a_ForEachChunkProvider, const Vector3i &a_MinCoords, int a_DataTypes) |
Writes the area back into cWorld at the coords specified. More... | |
bool | Write (cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ) |
Writes the area back into cWorld at the coords specified. More... | |
bool | Write (cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) |
Writes the area back into cWorld at the coords specified. More... | |
Static Public Member Functions | |
static bool | IsValidDataTypeCombination (int a_DataTypes) |
Returns true if the datatype combination is valid. More... | |
static size_t | MakeIndexForSize (Vector3i a_RelPos, Vector3i a_Size) |
Protected Types | |
using | BLOCKARRAY = std::unique_ptr< BLOCKTYPE[]> |
using | cBlockEntitiesPtr = std::unique_ptr< cBlockEntities > |
using | NIBBLEARRAY = std::unique_ptr< NIBBLETYPE[]> |
Protected Member Functions | |
void | CropBlockTypes (int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ) |
void | CropNibbles (NIBBLEARRAY &a_Array, int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ) |
void | ExpandBlockTypes (int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ) |
void | ExpandNibbles (NIBBLEARRAY &a_Array, int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ) |
cBlockEntity * | GetBlockEntityRel (Vector3i a_RelPos) |
Returns the cBlockEntity at the specified coords, or nullptr if none. More... | |
NIBBLETYPE | GetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE *a_Array) const |
NIBBLETYPE | GetRelNibble (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE *a_Array) const |
void | MergeBlockEntities (int a_RelX, int a_RelY, int a_RelZ, const cBlockArea &a_Src) |
Updates m_BlockEntities to remove BEs that no longer match the blocktype at their coords, and clones from a_Src the BEs that are missing. More... | |
template<bool MetasValid> | |
void | MergeByStrategy (const cBlockArea &a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy, const NIBBLETYPE *SrcMetas, NIBBLETYPE *DstMetas) |
void | RelSetData (int a_RelX, int a_RelY, int a_RelZ, int a_DataTypes, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, NIBBLETYPE a_BlockLight, NIBBLETYPE a_BlockSkyLight) |
Sets the specified datatypes at the specified location. More... | |
void | RemoveNonMatchingBlockEntities (void) |
Removes from m_BlockEntities those BEs that no longer match the blocktype at their coords. More... | |
void | RescanBlockEntities (void) |
Updates m_BlockEntities to remove BEs that no longer match the blocktype at their coords, and add new BEs that are missing. More... | |
void | SetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE *a_Array) |
void | SetRelNibble (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE *a_Array) |
bool | SetSize (int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes) |
Clears the data stored and prepares a fresh new block area with the specified dimensions. More... | |
Protected Attributes | |
cBlockEntitiesPtr | m_BlockEntities |
The block entities contained within the area. More... | |
NIBBLEARRAY | m_BlockLight |
NIBBLEARRAY | m_BlockMetas |
NIBBLEARRAY | m_BlockSkyLight |
BLOCKARRAY | m_BlockTypes |
Vector3i | m_Origin |
Vector3i | m_Size |
Vector3i | m_WEOffset |
An extra data value sometimes stored in the .schematic file. More... | |
Private Member Functions | |
DISALLOW_COPY_AND_ASSIGN (cBlockArea) | |
Friends | |
class | cChunkDesc |
class | cSchematicFileSerializer |
Definition at line 37 of file BlockArea.h.
|
protected |
Definition at line 457 of file BlockArea.h.
|
protected |
Definition at line 458 of file BlockArea.h.
|
protected |
Definition at line 456 of file BlockArea.h.
anonymous enum |
What data is to be queried (bit-mask)
Enumerator | |
---|---|
baTypes | |
baMetas | |
baLight | |
baSkyLight | |
baBlockEntities |
Definition at line 46 of file BlockArea.h.
The per-block strategy to use when merging another block area into this object.
See the Merge function for the description of these
Enumerator | |
---|---|
msOverwrite | |
msFillAir | |
msImprint | |
msLake | |
msSpongePrint | |
msDifference | |
msSimpleCompare | |
msMask |
Definition at line 58 of file BlockArea.h.
|
default |
void cBlockArea::Clear | ( | void | ) |
Clears the data stored to reclaim memory.
Definition at line 323 of file BlockArea.cpp.
void cBlockArea::CopyFrom | ( | const cBlockArea & | a_From | ) |
Copies the contents from the specified BlockArea into this object.
Definition at line 587 of file BlockArea.cpp.
void cBlockArea::CopyTo | ( | cBlockArea & | a_Into | ) | const |
Copies this object's contents into the specified BlockArea.
Definition at line 544 of file BlockArea.cpp.
size_t cBlockArea::CountNonAirBlocks | ( | void | ) | const |
Returns the count of blocks that are not air.
Returns 0 if blocktypes not available. Block metas are ignored (if present, air with any meta is still considered air).
Definition at line 1889 of file BlockArea.cpp.
size_t cBlockArea::CountSpecificBlocks | ( | BLOCKTYPE | a_BlockType | ) | const |
Returns how many times the specified block is contained in the area.
The blocks' meta values are ignored, only the blocktype is compared.
Definition at line 1920 of file BlockArea.cpp.
size_t cBlockArea::CountSpecificBlocks | ( | BLOCKTYPE | a_BlockType, |
NIBBLETYPE | a_BlockMeta | ||
) | const |
Returns how many times the specified block is contained in the area.
Both the block's type and meta must match in order to be counted in. If the block metas aren't present in the area, logs a warning and ignores the meta specification.
Definition at line 1946 of file BlockArea.cpp.
void cBlockArea::Create | ( | const Vector3i & | a_Size, |
int | a_DataTypes = baTypes | baMetas | baBlockEntities |
||
) |
Creates a new area of the specified size and contents.
Origin is set to all zeroes. BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light.
Definition at line 360 of file BlockArea.cpp.
void cBlockArea::Create | ( | int | a_SizeX, |
int | a_SizeY, | ||
int | a_SizeZ, | ||
int | a_DataTypes = baTypes | baMetas | baBlockEntities |
||
) |
Creates a new area of the specified size and contents.
Origin is set to all zeroes. BlockTypes are set to air, block metas to zero, blocklights to zero and skylights to full light.
Definition at line 338 of file BlockArea.cpp.
void cBlockArea::Crop | ( | int | a_AddMinX, |
int | a_SubMaxX, | ||
int | a_AddMinY, | ||
int | a_SubMaxY, | ||
int | a_AddMinZ, | ||
int | a_SubMaxZ | ||
) |
Crops the internal contents by the specified amount of blocks from each border.
Definition at line 635 of file BlockArea.cpp.
|
protected |
Definition at line 2253 of file BlockArea.cpp.
|
protected |
Definition at line 2278 of file BlockArea.cpp.
|
private |
bool cBlockArea::DoWithBlockEntityAt | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
cBlockEntityCallback | a_Callback | ||
) |
Calls the callback for the block entity at the specified coords.
Returns false if there is no block entity at those coords. Returns the value that the callback has returned if there is a block entity.
Definition at line 2178 of file BlockArea.cpp.
bool cBlockArea::DoWithBlockEntityRelAt | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
cBlockEntityCallback | a_Callback | ||
) |
Calls the callback for the block entity at the specified coords.
Returns false if there is no block entity at those coords, or the block area doesn't have baBlockEntities. Returns the value that the callback has returned if there is a block entity.
Definition at line 2158 of file BlockArea.cpp.
void cBlockArea::DumpToRawFile | ( | const AString & | a_FileName | ) |
For testing purposes only, dumps the area into a file.
Definition at line 596 of file BlockArea.cpp.
void cBlockArea::Expand | ( | int | a_SubMinX, |
int | a_AddMaxX, | ||
int | a_SubMinY, | ||
int | a_AddMaxY, | ||
int | a_SubMinZ, | ||
int | a_AddMaxZ | ||
) |
Expands the internal contents by the specified amount of blocks from each border.
Definition at line 698 of file BlockArea.cpp.
|
protected |
Definition at line 2302 of file BlockArea.cpp.
|
protected |
Definition at line 2331 of file BlockArea.cpp.
void cBlockArea::Fill | ( | int | a_DataTypes, |
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta = 0 , |
||
NIBBLETYPE | a_BlockLight = 0 , |
||
NIBBLETYPE | a_BlockSkyLight = 0x0f |
||
) |
Fills the entire block area with the specified data.
Definition at line 773 of file BlockArea.cpp.
void cBlockArea::FillRelCuboid | ( | const cCuboid & | a_RelCuboid, |
int | a_DataTypes, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta = 0 , |
||
NIBBLETYPE | a_BlockLight = 0 , |
||
NIBBLETYPE | a_BlockSkyLight = 0x0f |
||
) |
Fills a cuboid inside the block area with the specified data.
a_Cuboid must be sorted.
Definition at line 891 of file BlockArea.cpp.
void cBlockArea::FillRelCuboid | ( | int | a_MinRelX, |
int | a_MaxRelX, | ||
int | a_MinRelY, | ||
int | a_MaxRelY, | ||
int | a_MinRelZ, | ||
int | a_MaxRelZ, | ||
int | a_DataTypes, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta = 0 , |
||
NIBBLETYPE | a_BlockLight = 0 , |
||
NIBBLETYPE | a_BlockSkyLight = 0x0f |
||
) |
Fills a cuboid inside the block area with the specified data.
Definition at line 831 of file BlockArea.cpp.
bool cBlockArea::ForEachBlockEntity | ( | cBlockEntityCallback | a_Callback | ) |
Calls the callback for all the block entities.
If the callback returns true, aborts the enumeration and returns false. If the callback returns true, continues with the next BE. Returns true if all block entities have been enumerated (including the case when there is none or the area is without baBlockEntities).
Definition at line 2187 of file BlockArea.cpp.
|
inline |
Definition at line 393 of file BlockArea.h.
|
inline |
Direct read-only access to block entities.
Definition at line 426 of file BlockArea.h.
|
protected |
Returns the cBlockEntity at the specified coords, or nullptr if none.
Definition at line 2685 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetBlockLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1760 of file BlockArea.cpp.
|
inline |
Definition at line 391 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetBlockMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1742 of file BlockArea.cpp.
|
inline |
Definition at line 390 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetBlockSkyLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1778 of file BlockArea.cpp.
|
inline |
Definition at line 392 of file BlockArea.h.
BLOCKTYPE cBlockArea::GetBlockType | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1724 of file BlockArea.cpp.
void cBlockArea::GetBlockTypeMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
BLOCKTYPE & | a_BlockType, | ||
NIBBLETYPE & | a_BlockMeta | ||
) | const |
Definition at line 1840 of file BlockArea.cpp.
|
inline |
Returns the internal pointer to the block types.
Definition at line 389 of file BlockArea.h.
cCuboid cBlockArea::GetBounds | ( | void | ) | const |
Definition at line 1877 of file BlockArea.cpp.
int cBlockArea::GetDataTypes | ( | void | ) | const |
Returns the datatypes that are stored in the object (bitmask of baXXX values)
Definition at line 2046 of file BlockArea.cpp.
|
protected |
Definition at line 2244 of file BlockArea.cpp.
void cBlockArea::GetNonAirCropRelCoords | ( | int & | a_MinRelX, |
int & | a_MinRelY, | ||
int & | a_MinRelZ, | ||
int & | a_MaxRelX, | ||
int & | a_MaxRelY, | ||
int & | a_MaxRelZ, | ||
BLOCKTYPE | a_IgnoreBlockType = E_BLOCK_AIR |
||
) |
Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction.
If there are no non-ignored blocks within the area, or blocktypes are not present, the returned values are reverse-ranges (MinX <- m_RangeX, MaxX <- 0 etc.) Exported to Lua in ManualBindings.cpp.
Definition at line 1979 of file BlockArea.cpp.
|
inline |
Definition at line 341 of file BlockArea.h.
|
inline |
Definition at line 354 of file BlockArea.h.
|
inline |
Definition at line 355 of file BlockArea.h.
|
inline |
Definition at line 356 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetRelBlockLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1751 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetRelBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1733 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetRelBlockSkyLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1769 of file BlockArea.cpp.
BLOCKTYPE cBlockArea::GetRelBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1710 of file BlockArea.cpp.
void cBlockArea::GetRelBlockTypeMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE & | a_BlockType, | ||
NIBBLETYPE & | a_BlockMeta | ||
) | const |
Definition at line 1849 of file BlockArea.cpp.
|
protected |
Definition at line 2230 of file BlockArea.cpp.
|
inline |
Definition at line 340 of file BlockArea.h.
|
inline |
Definition at line 347 of file BlockArea.h.
|
inline |
Definition at line 348 of file BlockArea.h.
|
inline |
Definition at line 349 of file BlockArea.h.
|
inline |
Returns the volume of the area, as number of blocks.
Definition at line 352 of file BlockArea.h.
|
inline |
Definition at line 320 of file BlockArea.h.
|
inline |
Definition at line 365 of file BlockArea.h.
|
inline |
Definition at line 363 of file BlockArea.h.
|
inline |
Definition at line 362 of file BlockArea.h.
|
inline |
Definition at line 364 of file BlockArea.h.
|
inline |
Definition at line 361 of file BlockArea.h.
bool cBlockArea::IsValidCoords | ( | const Vector3i & | a_Coords | ) | const |
Returns true if the specified coords are within this area's coord range (as indicated by m_Origin).
Definition at line 436 of file BlockArea.cpp.
bool cBlockArea::IsValidCoords | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Returns true if the specified coords are within this area's coord range (as indicated by m_Origin).
Definition at line 427 of file BlockArea.cpp.
|
static |
Returns true if the datatype combination is valid.
Invalid combinations include BlockEntities without BlockTypes.
Definition at line 304 of file BlockArea.cpp.
bool cBlockArea::IsValidRelCoords | ( | const Vector3i & | a_RelCoords | ) | const |
Returns true if the specified relative coords are within this area's coord range (0 - m_Size).
Definition at line 418 of file BlockArea.cpp.
bool cBlockArea::IsValidRelCoords | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Returns true if the specified relative coords are within this area's coord range (0 - m_Size).
Definition at line 405 of file BlockArea.cpp.
|
inline |
OBSOLETE, use the Vector3i-based overload instead.
Returns the index into the internal arrays for the specified coords
Definition at line 404 of file BlockArea.h.
|
inline |
Returns the index into the internal arrays for the specified coords.
Definition at line 397 of file BlockArea.h.
Definition at line 2142 of file BlockArea.cpp.
void cBlockArea::Merge | ( | const cBlockArea & | a_Src, |
const Vector3i & | a_RelMinCoords, | ||
eMergeStrategy | a_Strategy | ||
) |
Merges another block area into this one, using the specified block combinating strategy.
See Merge() above for details.
Definition at line 764 of file BlockArea.cpp.
void cBlockArea::Merge | ( | const cBlockArea & | a_Src, |
int | a_RelX, | ||
int | a_RelY, | ||
int | a_RelZ, | ||
eMergeStrategy | a_Strategy | ||
) |
Merges another block area into this one, using the specified block combinating strategy This function combines another BlockArea into the current object.
The a_RelX, a_RelY and a_RelZ parameters specify the coords of this BA where a_Src should be copied. If both areas contain baBlockEntities, the BEs are merged (with preference of keeping this' ones) (MergeBlockEntities()). If only this contains BEs, but a_Src doesn't, the BEs are checked after merge to remove the overwritten ones and create the missing ones (UpdateBlockEntities()). The strategy parameter specifies how individual blocks are combined together, using the table below.
| area block | result | | this | Src | msOverwrite | msFillAir | msImprint | +---—+--—+----------—+--------—+--------—+ | air | air | air | air | air | | A | air | air | A | A | | air | B | B | B | B | | A | B | B | A | B |
So to sum up:
Special strategies (evaluate top-down, first match wins): msLake: | area block | | | this | Src | result | +-------—+-----—+-----—+ | A | sponge | A | Sponge is the NOP block | * | air | air | Air always gets hollowed out, even under the oceans | water | * | water | Water is never overwritten | lava | * | lava | Lava is never overwritten | * | water | water | Water always overwrites anything | * | lava | lava | Lava always overwrites anything | dirt | stone | stone | Stone overwrites dirt | grass | stone | stone | ... and grass | mycelium | stone | stone | ... and mycelium | A | stone | A | ... but nothing else | A | * | A | Everything else is left as it is
msSpongePrint: Used for most generators, it allows carving out air pockets, too, and uses the Sponge as the NOP block | area block | | | this | Src | result | +-------—+-----—+-----—+ | A | sponge | A | Sponge is the NOP block | * | B | B | Everything else overwrites anything
msDifference: Used to determine the differences between two areas. Only the differring blocks are preserved: | area block | | | this | Src | result | +---—+----—+-----—+ | A | A | air | Same blocks are replaced with air | A | non-A | A | Differring blocks are kept from "this"
msSimpleCompare: Used to determine the differences between two areas. Blocks that differ are replaced with stone, same blocks are replaced with air | area block | | | this | Src | result | +---—+----—+-----—+ | A | A | air | Same blocks are replaced with air | A | non-A | stone | Differring blocks are replaced with stone
msMask: Combines two areas, the blocks that are the same are kept, differing ones are reset to air | area block | | | this | Src | result | +---—+----—+-----—+ | A | A | A | Same blocks are kept | A | non-A | air | Everything else is replaced with air
Definition at line 742 of file BlockArea.cpp.
|
protected |
Updates m_BlockEntities to remove BEs that no longer match the blocktype at their coords, and clones from a_Src the BEs that are missing.
a_RelX, a_RelY and a_RelZ are relative coords that should be added to all BEs from a_Src before checking them. If a block should have a BE but one cannot be found in either this or a_Src, a new one is created.
Definition at line 2574 of file BlockArea.cpp.
|
protected |
Definition at line 2416 of file BlockArea.cpp.
void cBlockArea::MirrorXY | ( | void | ) |
Mirrors the entire area around the XY plane.
Definition at line 1161 of file BlockArea.cpp.
void cBlockArea::MirrorXYNoMeta | ( | void | ) |
Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta.
Definition at line 1454 of file BlockArea.cpp.
void cBlockArea::MirrorXZ | ( | void | ) |
Mirrors the entire area around the XZ plane.
Definition at line 1218 of file BlockArea.cpp.
void cBlockArea::MirrorXZNoMeta | ( | void | ) |
Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta.
Definition at line 1508 of file BlockArea.cpp.
void cBlockArea::MirrorYZ | ( | void | ) |
Mirrors the entire area around the YZ plane.
Definition at line 1275 of file BlockArea.cpp.
void cBlockArea::MirrorYZNoMeta | ( | void | ) |
Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta.
Definition at line 1562 of file BlockArea.cpp.
bool cBlockArea::Read | ( | cForEachChunkProvider & | a_ForEachChunkProvider, |
const cCuboid & | a_Bounds, | ||
int | a_DataTypes = baTypes | baMetas | baBlockEntities |
||
) |
Reads an area of blocks specified.
Returns true if successful. The bounds are included in the read area.
Definition at line 488 of file BlockArea.cpp.
bool cBlockArea::Read | ( | cForEachChunkProvider & | a_ForEachChunkProvider, |
const Vector3i & | a_Point1, | ||
const Vector3i & | a_Point2, | ||
int | a_DataTypes = baTypes | baMetas | baBlockEntities |
||
) |
Reads an area of blocks specified.
Returns true if successful. The bounds are included in the read area.
Definition at line 503 of file BlockArea.cpp.
bool cBlockArea::Read | ( | cForEachChunkProvider & | a_ForEachChunkProvider, |
int | a_MinBlockX, | ||
int | a_MaxBlockX, | ||
int | a_MinBlockY, | ||
int | a_MaxBlockY, | ||
int | a_MinBlockZ, | ||
int | a_MaxBlockZ, | ||
int | a_DataTypes = baTypes | baMetas | baBlockEntities |
||
) |
Reads an area of blocks specified.
Returns true if successful. All coords are inclusive.
Definition at line 445 of file BlockArea.cpp.
void cBlockArea::RelLine | ( | const Vector3i & | a_Point1, |
const Vector3i & | a_Point2, | ||
int | a_DataTypes, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta = 0 , |
||
NIBBLETYPE | a_BlockLight = 0 , |
||
NIBBLETYPE | a_BlockSkyLight = 0x0f |
||
) |
Draws a line between two points with the specified data.
The line endpoints needn't be valid coords inside the area.
Definition at line 1025 of file BlockArea.cpp.
void cBlockArea::RelLine | ( | int | a_RelX1, |
int | a_RelY1, | ||
int | a_RelZ1, | ||
int | a_RelX2, | ||
int | a_RelY2, | ||
int | a_RelZ2, | ||
int | a_DataTypes, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta = 0 , |
||
NIBBLETYPE | a_BlockLight = 0 , |
||
NIBBLETYPE | a_BlockSkyLight = 0x0f |
||
) |
Draws a line between two points with the specified data.
The line endpoints needn't be valid coords inside the area.
Definition at line 908 of file BlockArea.cpp.
|
protected |
Sets the specified datatypes at the specified location.
If the coords are not valid, ignores the call (so that RelLine() can work simply).
Definition at line 2360 of file BlockArea.cpp.
|
protected |
Removes from m_BlockEntities those BEs that no longer match the blocktype at their coords.
Definition at line 2663 of file BlockArea.cpp.
|
protected |
Updates m_BlockEntities to remove BEs that no longer match the blocktype at their coords, and add new BEs that are missing.
Definition at line 2627 of file BlockArea.cpp.
void cBlockArea::RotateCCW | ( | void | ) |
Rotates the entire area counter-clockwise around the Y axis.
Definition at line 1041 of file BlockArea.cpp.
void cBlockArea::RotateCCWNoMeta | ( | void | ) |
Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta.
Definition at line 1332 of file BlockArea.cpp.
void cBlockArea::RotateCW | ( | void | ) |
Rotates the entire area clockwise around the Y axis.
Definition at line 1101 of file BlockArea.cpp.
void cBlockArea::RotateCWNoMeta | ( | void | ) |
Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta.
Definition at line 1393 of file BlockArea.cpp.
void cBlockArea::SetBlockLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockLight | ||
) |
Definition at line 1683 of file BlockArea.cpp.
void cBlockArea::SetBlockMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1665 of file BlockArea.cpp.
void cBlockArea::SetBlockSkyLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockSkyLight | ||
) |
Definition at line 1701 of file BlockArea.cpp.
void cBlockArea::SetBlockType | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 1647 of file BlockArea.cpp.
void cBlockArea::SetBlockTypeMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1787 of file BlockArea.cpp.
|
protected |
Definition at line 2221 of file BlockArea.cpp.
void cBlockArea::SetOrigin | ( | const Vector3i & | a_Origin | ) |
Resets the origin.
No other changes are made, contents are untouched.
Definition at line 396 of file BlockArea.cpp.
void cBlockArea::SetOrigin | ( | int | a_OriginX, |
int | a_OriginY, | ||
int | a_OriginZ | ||
) |
Resets the origin.
No other changes are made, contents are untouched.
Definition at line 387 of file BlockArea.cpp.
void cBlockArea::SetRelBlockLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockLight | ||
) |
Definition at line 1674 of file BlockArea.cpp.
void cBlockArea::SetRelBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1656 of file BlockArea.cpp.
void cBlockArea::SetRelBlockSkyLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockSkyLight | ||
) |
Definition at line 1692 of file BlockArea.cpp.
void cBlockArea::SetRelBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 1616 of file BlockArea.cpp.
void cBlockArea::SetRelBlockTypeMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE | a_BlockType, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1796 of file BlockArea.cpp.
|
protected |
Definition at line 2207 of file BlockArea.cpp.
|
protected |
Clears the data stored and prepares a fresh new block area with the specified dimensions.
Definition at line 2076 of file BlockArea.cpp.
void cBlockArea::SetWEOffset | ( | const Vector3i & | a_Offset | ) |
Definition at line 378 of file BlockArea.cpp.
void cBlockArea::SetWEOffset | ( | int | a_OffsetX, |
int | a_OffsetY, | ||
int | a_OffsetZ | ||
) |
Definition at line 369 of file BlockArea.cpp.
|
inline |
Writes the area back into cWorld at the coords specified.
Returns true if successful in all chunks, false if only partially / not at all. Doesn't wake up the simulators.
Definition at line 143 of file BlockArea.h.
bool cBlockArea::Write | ( | cForEachChunkProvider & | a_ForEachChunkProvider, |
const Vector3i & | a_MinCoords, | ||
int | a_DataTypes | ||
) |
Writes the area back into cWorld at the coords specified.
Returns true if successful in all chunks, false if only partially / not at all. Doesn't wake up the simulators.
Definition at line 531 of file BlockArea.cpp.
|
inline |
Writes the area back into cWorld at the coords specified.
Returns true if successful in all chunks, false if only partially / not at all. Doesn't wake up the simulators.
Definition at line 131 of file BlockArea.h.
bool cBlockArea::Write | ( | cForEachChunkProvider & | a_ForEachChunkProvider, |
int | a_MinBlockX, | ||
int | a_MinBlockY, | ||
int | a_MinBlockZ, | ||
int | a_DataTypes | ||
) |
Writes the area back into cWorld at the coords specified.
Returns true if successful in all chunks, false if only partially / not at all. Doesn't wake up the simulators.
Definition at line 518 of file BlockArea.cpp.
|
friend |
Definition at line 432 of file BlockArea.h.
|
friend |
Definition at line 433 of file BlockArea.h.
|
protected |
The block entities contained within the area.
Only valid if the area was created / read with the baBlockEntities flag. The block entities are owned by this object.
Definition at line 475 of file BlockArea.h.
|
protected |
Definition at line 469 of file BlockArea.h.
|
protected |
Definition at line 468 of file BlockArea.h.
|
protected |
Definition at line 470 of file BlockArea.h.
|
protected |
Definition at line 467 of file BlockArea.h.
|
protected |
Definition at line 460 of file BlockArea.h.
|
protected |
Definition at line 461 of file BlockArea.h.
|
protected |
An extra data value sometimes stored in the .schematic file.
Used mainly by the WorldEdit plugin. cBlockArea doesn't use this value in any way.
Definition at line 465 of file BlockArea.h.