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