Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <BlockArea.h>
Classes | |
class | cChunkReader |
struct | sBlockEntitiesDeleter |
Deleter to clear the block entities before deleting the container. More... | |
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 (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 | Create (const Vector3i &a_Size, 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 (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... | |
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... | |
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 (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 | 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 | 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... | |
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... | |
size_t | MakeIndex (Vector3i a_RelPos) const |
Returns the index into the internal arrays for the specified coords. More... | |
size_t | MakeIndex (int a_RelX, int a_RelY, int a_RelZ) const |
OBSOLETE, use the Vector3i-based overload instead. 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 | 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 | 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... | |
cItems | PickupsFromBlock (Vector3i a_AbsPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr) |
Returns the pickups that would result if the block at the specified position was mined by a_Digger, using a_Tool. 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... | |
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... | |
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 | 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 | 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 (int a_OriginX, int a_OriginY, int a_OriginZ) |
Resets the origin. More... | |
void | SetOrigin (const Vector3i &a_Origin) |
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 (int a_OffsetX, int a_OffsetY, int a_OffsetZ) |
void | SetWEOffset (const Vector3i &a_Offset) |
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... | |
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, const Vector3i &a_MinCoords, int a_DataTypes) |
Writes the area back into cWorld at the coords specified. More... | |
bool | Write (cForEachChunkProvider &a_ForEachChunkProvider, const Vector3i &a_MinCoords) |
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, sBlockEntitiesDeleter > |
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... | |
Static Protected Member Functions | |
static void | ClearBlockEntities (cBlockEntities &a_BlockEntities) |
Clears the block entities from the specified container, freeing each blockentity. 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 34 of file BlockArea.h.
|
protected |
Definition at line 456 of file BlockArea.h.
|
protected |
Definition at line 476 of file BlockArea.h.
|
protected |
Definition at line 455 of file BlockArea.h.
anonymous enum |
What data is to be queried (bit-mask)
Enumerator | |
---|---|
baTypes | |
baMetas | |
baLight | |
baSkyLight | |
baBlockEntities |
Definition at line 43 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 55 of file BlockArea.h.
|
default |
void cBlockArea::Clear | ( | void | ) |
Clears the data stored to reclaim memory.
Definition at line 321 of file BlockArea.cpp.
|
staticprotected |
Clears the block entities from the specified container, freeing each blockentity.
Definition at line 2601 of file BlockArea.cpp.
void cBlockArea::CopyFrom | ( | const cBlockArea & | a_From | ) |
Copies the contents from the specified BlockArea into this object.
Definition at line 585 of file BlockArea.cpp.
void cBlockArea::CopyTo | ( | cBlockArea & | a_Into | ) | const |
Copies this object's contents into the specified BlockArea.
Definition at line 542 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 1901 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 1932 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 1958 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 336 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 358 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 633 of file BlockArea.cpp.
|
protected |
Definition at line 2280 of file BlockArea.cpp.
|
protected |
Definition at line 2305 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 2190 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 2170 of file BlockArea.cpp.
void cBlockArea::DumpToRawFile | ( | const AString & | a_FileName | ) |
For testing purposes only, dumps the area into a file.
Definition at line 594 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 710 of file BlockArea.cpp.
|
protected |
Definition at line 2329 of file BlockArea.cpp.
|
protected |
Definition at line 2358 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 785 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 843 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 903 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 2199 of file BlockArea.cpp.
|
inline |
Definition at line 390 of file BlockArea.h.
|
inline |
Direct read-only access to block entities.
Definition at line 423 of file BlockArea.h.
|
protected |
Returns the cBlockEntity at the specified coords, or nullptr if none.
Definition at line 2729 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetBlockLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1772 of file BlockArea.cpp.
|
inline |
Definition at line 388 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetBlockMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1754 of file BlockArea.cpp.
|
inline |
Definition at line 387 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetBlockSkyLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1790 of file BlockArea.cpp.
|
inline |
Definition at line 389 of file BlockArea.h.
BLOCKTYPE cBlockArea::GetBlockType | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ | ||
) | const |
Definition at line 1736 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 1852 of file BlockArea.cpp.
|
inline |
Returns the internal pointer to the block types.
Definition at line 386 of file BlockArea.h.
cCuboid cBlockArea::GetBounds | ( | void | ) | const |
Definition at line 1889 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 2058 of file BlockArea.cpp.
|
protected |
Definition at line 2271 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 1991 of file BlockArea.cpp.
|
inline |
Definition at line 338 of file BlockArea.h.
|
inline |
Definition at line 351 of file BlockArea.h.
|
inline |
Definition at line 352 of file BlockArea.h.
|
inline |
Definition at line 353 of file BlockArea.h.
NIBBLETYPE cBlockArea::GetRelBlockLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1763 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetRelBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1745 of file BlockArea.cpp.
NIBBLETYPE cBlockArea::GetRelBlockSkyLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1781 of file BlockArea.cpp.
BLOCKTYPE cBlockArea::GetRelBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ | ||
) | const |
Definition at line 1722 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 1861 of file BlockArea.cpp.
|
protected |
Definition at line 2257 of file BlockArea.cpp.
|
inline |
Definition at line 337 of file BlockArea.h.
|
inline |
Definition at line 344 of file BlockArea.h.
|
inline |
Definition at line 345 of file BlockArea.h.
|
inline |
Definition at line 346 of file BlockArea.h.
|
inline |
Returns the volume of the area, as number of blocks.
Definition at line 349 of file BlockArea.h.
|
inline |
Definition at line 317 of file BlockArea.h.
|
inline |
Definition at line 362 of file BlockArea.h.
|
inline |
Definition at line 360 of file BlockArea.h.
|
inline |
Definition at line 359 of file BlockArea.h.
|
inline |
Definition at line 361 of file BlockArea.h.
|
inline |
Definition at line 358 of file BlockArea.h.
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 425 of file BlockArea.cpp.
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 434 of file BlockArea.cpp.
|
static |
Returns true if the datatype combination is valid.
Invalid combinations include BlockEntities without BlockTypes.
Definition at line 302 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 403 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 416 of file BlockArea.cpp.
|
inline |
Returns the index into the internal arrays for the specified coords.
Definition at line 394 of file BlockArea.h.
|
inline |
OBSOLETE, use the Vector3i-based overload instead.
Returns the index into the internal arrays for the specified coords
Definition at line 401 of file BlockArea.h.
Definition at line 2154 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 754 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 776 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 2614 of file BlockArea.cpp.
|
protected |
Definition at line 2443 of file BlockArea.cpp.
void cBlockArea::MirrorXY | ( | void | ) |
Mirrors the entire area around the XY plane.
Definition at line 1173 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 1466 of file BlockArea.cpp.
void cBlockArea::MirrorXZ | ( | void | ) |
Mirrors the entire area around the XZ plane.
Definition at line 1230 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 1520 of file BlockArea.cpp.
void cBlockArea::MirrorYZ | ( | void | ) |
Mirrors the entire area around the YZ plane.
Definition at line 1287 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 1574 of file BlockArea.cpp.
cItems cBlockArea::PickupsFromBlock | ( | Vector3i | a_AbsPos, |
const cEntity * | a_Digger = nullptr , |
||
const cItem * | a_Tool = nullptr |
||
) |
Returns the pickups that would result if the block at the specified position was mined by a_Digger, using a_Tool.
Definition at line 2219 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 443 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 486 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 501 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 920 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 1037 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 2387 of file BlockArea.cpp.
|
protected |
Removes from m_BlockEntities those BEs that no longer match the blocktype at their coords.
Definition at line 2703 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 2667 of file BlockArea.cpp.
void cBlockArea::RotateCCW | ( | void | ) |
Rotates the entire area counter-clockwise around the Y axis.
Definition at line 1053 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 1344 of file BlockArea.cpp.
void cBlockArea::RotateCW | ( | void | ) |
Rotates the entire area clockwise around the Y axis.
Definition at line 1113 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 1405 of file BlockArea.cpp.
void cBlockArea::SetBlockLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockLight | ||
) |
Definition at line 1695 of file BlockArea.cpp.
void cBlockArea::SetBlockMeta | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1677 of file BlockArea.cpp.
void cBlockArea::SetBlockSkyLight | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
NIBBLETYPE | a_BlockSkyLight | ||
) |
Definition at line 1713 of file BlockArea.cpp.
void cBlockArea::SetBlockType | ( | int | a_BlockX, |
int | a_BlockY, | ||
int | a_BlockZ, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 1659 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 1799 of file BlockArea.cpp.
|
protected |
Definition at line 2248 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 385 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 394 of file BlockArea.cpp.
void cBlockArea::SetRelBlockLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockLight | ||
) |
Definition at line 1686 of file BlockArea.cpp.
void cBlockArea::SetRelBlockMeta | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockMeta | ||
) |
Definition at line 1668 of file BlockArea.cpp.
void cBlockArea::SetRelBlockSkyLight | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
NIBBLETYPE | a_BlockSkyLight | ||
) |
Definition at line 1704 of file BlockArea.cpp.
void cBlockArea::SetRelBlockType | ( | int | a_RelX, |
int | a_RelY, | ||
int | a_RelZ, | ||
BLOCKTYPE | a_BlockType | ||
) |
Definition at line 1628 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 1808 of file BlockArea.cpp.
|
protected |
Definition at line 2234 of file BlockArea.cpp.
|
protected |
Clears the data stored and prepares a fresh new block area with the specified dimensions.
Definition at line 2088 of file BlockArea.cpp.
void cBlockArea::SetWEOffset | ( | int | a_OffsetX, |
int | a_OffsetY, | ||
int | a_OffsetZ | ||
) |
Definition at line 367 of file BlockArea.cpp.
void cBlockArea::SetWEOffset | ( | const Vector3i & | a_Offset | ) |
Definition at line 376 of file BlockArea.cpp.
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 516 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 128 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 529 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 140 of file BlockArea.h.
|
friend |
Definition at line 431 of file BlockArea.h.
|
friend |
Definition at line 432 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 481 of file BlockArea.h.
|
protected |
Definition at line 467 of file BlockArea.h.
|
protected |
Definition at line 466 of file BlockArea.h.
|
protected |
Definition at line 468 of file BlockArea.h.
|
protected |
Definition at line 465 of file BlockArea.h.
|
protected |
Definition at line 458 of file BlockArea.h.
|
protected |
Definition at line 459 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 463 of file BlockArea.h.