94 void SetOrigin(
int a_OriginX,
int a_OriginY,
int a_OriginZ);
106 bool IsValidCoords(
int a_BlockX,
int a_BlockY,
int a_BlockZ)
const;
127 bool Write(
cForEachChunkProvider & a_ForEachChunkProvider,
int a_MinBlockX,
int a_MinBlockY,
int a_MinBlockZ,
int a_DataTypes);
134 return Write(a_ForEachChunkProvider, a_MinBlockX, a_MinBlockY, a_MinBlockZ,
GetDataTypes());
146 return Write(a_ForEachChunkProvider, a_MinCoords.
x, a_MinCoords.
y, a_MinCoords.
z,
GetDataTypes());
161 void Crop(
int a_AddMinX,
int a_SubMaxX,
int a_AddMinY,
int a_SubMaxY,
int a_AddMinZ,
int a_SubMaxZ);
164 void Expand(
int a_SubMinX,
int a_AddMaxX,
int a_SubMinY,
int a_AddMaxY,
int a_SubMinZ,
int a_AddMaxZ);
249 void FillRelCuboid(
int a_MinRelX,
int a_MaxRelX,
int a_MinRelY,
int a_MaxRelY,
int a_MinRelZ,
int a_MaxRelZ,
261 void RelLine(
int a_RelX1,
int a_RelY1,
int a_RelZ1,
int a_RelX2,
int a_RelY2,
int a_RelZ2,
318 void SetWEOffset (
int a_OffsetX,
int a_OffsetY,
int a_OffsetZ);
404 size_t MakeIndex(
int a_RelX,
int a_RelY,
int a_RelZ)
const
436 public cChunkDataCallback
451 virtual bool Coords(
int a_ChunkX,
int a_ChunkZ)
override;
478 bool SetSize(
int a_SizeX,
int a_SizeY,
int a_SizeZ,
int a_DataTypes);
489 void CropBlockTypes(
int a_AddMinX,
int a_SubMaxX,
int a_AddMinY,
int a_SubMaxY,
int a_AddMinZ,
int a_SubMaxZ);
490 void CropNibbles (
NIBBLEARRAY & a_Array,
int a_AddMinX,
int a_SubMaxX,
int a_AddMinY,
int a_SubMaxY,
int a_AddMinZ,
int a_SubMaxZ);
493 void ExpandBlockTypes(
int a_SubMinX,
int a_AddMaxX,
int a_SubMinY,
int a_AddMaxY,
int a_SubMinZ,
int a_AddMaxZ);
494 void ExpandNibbles (
NIBBLEARRAY & a_Array,
int a_SubMinX,
int a_AddMaxX,
int a_SubMinY,
int a_AddMaxY,
int a_SubMinZ,
int a_AddMaxZ);
499 int a_RelX,
int a_RelY,
int a_RelZ,
504 template <
bool MetasVal
id>
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
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.
void GetRelBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
void SetRelBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
void SetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
void MergeByStrategy(const cBlockArea &a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy, const NIBBLETYPE *SrcMetas, NIBBLETYPE *DstMetas)
size_t MakeIndex(Vector3i a_RelPos) const
Returns the index into the internal arrays for the specified coords.
cBlockEntitiesPtr m_BlockEntities
The block entities contained within the area.
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.
void SetOrigin(int a_OriginX, int a_OriginY, int a_OriginZ)
Resets the origin.
static bool IsValidDataTypeCombination(int a_DataTypes)
Returns true if the datatype combination is valid.
void MirrorYZ(void)
Mirrors the entire area around the YZ plane.
NIBBLETYPE GetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE *a_Array) const
NIBBLETYPE GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) const
int GetVolume(void) const
Returns the volume of the area, as number of blocks.
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.
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.
const Vector3i & GetSize(void) const
NIBBLETYPE * GetBlockMetas(void) const
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.
bool ForEachBlockEntity(cBlockEntityCallback a_Callback)
Calls the callback for all the block entities.
void SetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockLight)
Vector3i m_WEOffset
An extra data value sometimes stored in the .schematic file.
void SetWEOffset(int a_OffsetX, int a_OffsetY, int a_OffsetZ)
std::unique_ptr< BLOCKTYPE[]> BLOCKARRAY
bool HasBlockSkyLights(void) const
void MirrorXY(void)
Mirrors the entire area around the XY plane.
void RescanBlockEntities(void)
Updates m_BlockEntities to remove BEs that no longer match the blocktype at their coords,...
size_t CountSpecificBlocks(BLOCKTYPE a_BlockType) const
Returns how many times the specified block is contained in the area.
void MirrorYZNoMeta(void)
Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta.
bool Write(cForEachChunkProvider &a_ForEachChunkProvider, const Vector3i &a_MinCoords)
Writes the area back into cWorld at the coords specified.
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.
void RotateCCWNoMeta(void)
Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta...
void SetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockSkyLight)
int GetOriginZ(void) const
void CropBlockTypes(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)
cBlockEntity * GetBlockEntityRel(Vector3i a_RelPos)
Returns the cBlockEntity at the specified coords, or nullptr if none.
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 dire...
void MirrorXYNoMeta(void)
Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta.
void GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
NIBBLETYPE GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE *a_Array) const
const Vector3i & GetWEOffset(void) const
size_t CountNonAirBlocks(void) const
Returns the count of blocks that are not air.
bool Write(cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ)
Writes the area back into cWorld at the coords specified.
void SetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType)
void SetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight)
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.
NIBBLETYPE GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ) const
void SetRelBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
bool HasBlockLights(void) const
bool HasBlockEntities(void) const
size_t GetBlockCount(void) const
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.
void CopyFrom(const cBlockArea &a_From)
Copies the contents from the specified BlockArea into this object.
NIBBLETYPE GetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ) const
bool HasBlockTypes(void) const
void RotateCW(void)
Rotates the entire area clockwise around the Y axis.
int GetDataTypes(void) const
Returns the datatypes that are stored in the object (bitmask of baXXX values)
void SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta)
void CropNibbles(NIBBLEARRAY &a_Array, int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY, int a_AddMinZ, int a_SubMaxZ)
int GetOriginY(void) const
void MirrorXZ(void)
Mirrors the entire area around the XZ plane.
BLOCKTYPE * GetBlockTypes(void) const
Returns the internal pointer to the block types.
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.
int GetOriginX(void) const
void RotateCCW(void)
Rotates the entire area counter-clockwise around the Y axis.
BLOCKTYPE GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) const
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.
void SetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockLight)
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.
void MirrorXZNoMeta(void)
Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta.
cCuboid GetBounds(void) const
DISALLOW_COPY_AND_ASSIGN(cBlockArea)
NIBBLETYPE * GetBlockSkyLight(void) const
NIBBLETYPE GetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ) const
NIBBLETYPE * GetBlockLight(void) const
eMergeStrategy
The per-block strategy to use when merging another block area into this object.
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.
void DumpToRawFile(const AString &a_FileName)
For testing purposes only, dumps the area into a file.
void SetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE *a_Array)
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).
void CopyTo(cBlockArea &a_Into) const
Copies this object's contents into the specified BlockArea.
std::unique_ptr< NIBBLETYPE[]> NIBBLEARRAY
static size_t MakeIndexForSize(Vector3i a_RelPos, Vector3i a_Size)
std::unique_ptr< cBlockEntities > cBlockEntitiesPtr
const cBlockEntities & GetBlockEntities(void) const
Direct read-only access to block entities.
bool HasBlockMetas(void) const
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...
size_t MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const
OBSOLETE, use the Vector3i-based overload instead.
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,...
void RotateCWNoMeta(void)
Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta.
void SetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE *a_Array)
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).
void ExpandNibbles(NIBBLEARRAY &a_Array, int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ)
void SetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta)
void Clear(void)
Clears the data stored to reclaim memory.
NIBBLEARRAY m_BlockSkyLight
const Vector3i & GetOrigin(void) const
void RemoveNonMatchingBlockEntities(void)
Removes from m_BlockEntities those BEs that no longer match the blocktype at their coords.
BLOCKTYPE GetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ) const
virtual bool Coords(int a_ChunkX, int a_ChunkZ) override
virtual void BlockEntity(cBlockEntity *a_BlockEntity) override
cChunkReader(cBlockArea &a_Area)
cCuboid m_AreaBounds
Bounds of the whole area being read, in world coords.
void CopyNibbles(NIBBLETYPE *a_AreaDst, const NIBBLETYPE *a_ChunkSrc)
virtual void ChunkData(const ChunkBlockData &a_BlockData, const ChunkLightData &a_LightData) override
This class bridges a vector of cItem for safe access via Lua.
std::unordered_map< size_t, OwnedBlockEntity > cBlockEntities