API
Functions and classes available in the Lua API
Public Types | Public Member Functions | List of all members
cBlockArea Class Reference

#include <0029.h>

Public Types

enum  { baTypes = 1, baMetas = 2, baLight = 4, baSkyLight = 8 }
 What data is to be queried (bit-mask) More...
enum  eMergeStrategy { msOverwrite, msFillAir, msImprint, msLake }

Public Member Functions

 cBlockArea (void)
void Clear (void)
 Clears the data stored to reclaim memory.
void CopyFrom (const cBlockArea &a_From)
 Copies the contents from the specified BlockArea into this object.
void CopyTo (cBlockArea &a_Into) const
 Copies this object's contents into the specified BlockArea.
void Create (int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes=baTypes|baMetas)
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 DumpToRawFile (const AString &a_FileName)
 For testing purposes only, dumps the area into a file.
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 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.
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.
NIBBLETYPE GetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ) const
NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ) const
NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ) 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
int GetDataTypes (void) const
 Returns the datatypes that are stored in the object (bitmask of baXXX values)
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
int GetSizeX (void) const
int GetSizeY (void) const
int GetSizeZ (void) const
bool HasBlockLights (void) const
bool HasBlockMetas (void) const
bool HasBlockSkyLights (void) const
bool HasBlockTypes (void) const
bool LoadFromSchematicFile (const AString &a_FileName)
 Loads an area from a .schematic file. Returns true if successful.
void Merge (const cBlockArea &a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy)
void MirrorXY (void)
 Mirrors the entire area around the XY plane.
void MirrorXYNoMeta (void)
 Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta.
void MirrorXZ (void)
 Mirrors the entire area around the XZ plane.
void MirrorXZNoMeta (void)
 Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta.
void MirrorYZ (void)
 Mirrors the entire area around the YZ plane.
void MirrorYZNoMeta (void)
 Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta.
bool Read (cWorld *a_World, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes=baTypes|baMetas)
 Reads an area of blocks specified. Returns true if successful. All coords are inclusive.
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 from between two points with the specified data.
void RotateCCW (void)
 Rotates the entire area counter-clockwise around the Y axis.
void RotateCCWNoMeta (void)
 Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta.
void RotateCW (void)
 Rotates the entire area clockwise around the Y axis.
void RotateCWNoMeta (void)
 Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta.
bool SaveToSchematicFile (const AString &a_FileName)
 Saves the area into a .schematic file. Returns true if successful.
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. No other changes are made, contents are untouched.
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)
bool Write (cWorld *a_World, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes=baTypes|baMetas)
 Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all.
 ~cBlockArea ()

Member Enumeration Documentation

anonymous enum

What data is to be queried (bit-mask)

Enumerator:
baTypes 
baMetas 
baLight 
baSkyLight 
Enumerator:
msOverwrite 
msFillAir 
msImprint 
msLake 

Constructor & Destructor Documentation

cBlockArea::cBlockArea ( void  )
cBlockArea::~cBlockArea ( )

Member Function Documentation

void cBlockArea::Clear ( void  )

Clears the data stored to reclaim memory.

void cBlockArea::CopyFrom ( const cBlockArea a_From)

Copies the contents from the specified BlockArea into this object.

void cBlockArea::CopyTo ( cBlockArea a_Into) const

Copies this object's contents into the specified BlockArea.

void cBlockArea::Create ( int  a_SizeX,
int  a_SizeY,
int  a_SizeZ,
int  a_DataTypes = baTypes|baMetas 
)
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.

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.

void cBlockArea::DumpToRawFile ( const AString &  a_FileName)

For testing purposes only, dumps the area into a file.

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.

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.

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.

NIBBLETYPE cBlockArea::GetBlockLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
) const
NIBBLETYPE cBlockArea::GetBlockMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
) const
NIBBLETYPE cBlockArea::GetBlockSkyLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
) const
BLOCKTYPE cBlockArea::GetBlockType ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
) const
void cBlockArea::GetBlockTypeMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE &  a_BlockType,
NIBBLETYPE &  a_BlockMeta 
) const
int cBlockArea::GetDataTypes ( void  ) const

Returns the datatypes that are stored in the object (bitmask of baXXX values)

int cBlockArea::GetOriginX ( void  ) const
inline
int cBlockArea::GetOriginY ( void  ) const
inline
int cBlockArea::GetOriginZ ( void  ) const
inline
NIBBLETYPE cBlockArea::GetRelBlockLight ( int  a_RelX,
int  a_RelY,
int  a_RelZ 
) const
NIBBLETYPE cBlockArea::GetRelBlockMeta ( int  a_RelX,
int  a_RelY,
int  a_RelZ 
) const
NIBBLETYPE cBlockArea::GetRelBlockSkyLight ( int  a_RelX,
int  a_RelY,
int  a_RelZ 
) const
BLOCKTYPE cBlockArea::GetRelBlockType ( int  a_RelX,
int  a_RelY,
int  a_RelZ 
) const
void cBlockArea::GetRelBlockTypeMeta ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
BLOCKTYPE &  a_BlockType,
NIBBLETYPE &  a_BlockMeta 
) const
int cBlockArea::GetSizeX ( void  ) const
inline
int cBlockArea::GetSizeY ( void  ) const
inline
int cBlockArea::GetSizeZ ( void  ) const
inline
bool cBlockArea::HasBlockLights ( void  ) const
inline
bool cBlockArea::HasBlockMetas ( void  ) const
inline
bool cBlockArea::HasBlockSkyLights ( void  ) const
inline
bool cBlockArea::HasBlockTypes ( void  ) const
inline
bool cBlockArea::LoadFromSchematicFile ( const AString &  a_FileName)

Loads an area from a .schematic file. Returns true if successful.

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 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:

  • msOverwrite completely overwrites all blocks with the Src's blocks
  • msFillAir overwrites only those blocks that were air
  • msImprint overwrites with only those blocks that are non-air

Special strategies: msLake (evaluate top-down, first match wins): | 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

void cBlockArea::MirrorXY ( void  )

Mirrors the entire area around the XY plane.

void cBlockArea::MirrorXYNoMeta ( void  )

Mirrors the entire area around the XY plane, doesn't use blockhandlers for block meta.

void cBlockArea::MirrorXZ ( void  )

Mirrors the entire area around the XZ plane.

void cBlockArea::MirrorXZNoMeta ( void  )

Mirrors the entire area around the XZ plane, doesn't use blockhandlers for block meta.

void cBlockArea::MirrorYZ ( void  )

Mirrors the entire area around the YZ plane.

void cBlockArea::MirrorYZNoMeta ( void  )

Mirrors the entire area around the YZ plane, doesn't use blockhandlers for block meta.

bool cBlockArea::Read ( cWorld a_World,
int  a_MinBlockX,
int  a_MaxBlockX,
int  a_MinBlockY,
int  a_MaxBlockY,
int  a_MinBlockZ,
int  a_MaxBlockZ,
int  a_DataTypes = baTypes|baMetas 
)

Reads an area of blocks specified. Returns true if successful. All coords are inclusive.

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 from between two points with the specified data.

void cBlockArea::RotateCCW ( void  )

Rotates the entire area counter-clockwise around the Y axis.

void cBlockArea::RotateCCWNoMeta ( void  )

Rotates the entire area counter-clockwise around the Y axis, doesn't use blockhandlers for block meta.

void cBlockArea::RotateCW ( void  )

Rotates the entire area clockwise around the Y axis.

void cBlockArea::RotateCWNoMeta ( void  )

Rotates the entire area clockwise around the Y axis, doesn't use blockhandlers for block meta.

bool cBlockArea::SaveToSchematicFile ( const AString &  a_FileName)

Saves the area into a .schematic file. Returns true if successful.

void cBlockArea::SetBlockLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_BlockLight 
)
void cBlockArea::SetBlockMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_BlockMeta 
)
void cBlockArea::SetBlockSkyLight ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_BlockSkyLight 
)
void cBlockArea::SetBlockType ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType 
)
void cBlockArea::SetBlockTypeMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
void cBlockArea::SetOrigin ( int  a_OriginX,
int  a_OriginY,
int  a_OriginZ 
)

Resets the origin. No other changes are made, contents are untouched.

void cBlockArea::SetRelBlockLight ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
NIBBLETYPE  a_BlockLight 
)
void cBlockArea::SetRelBlockMeta ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
NIBBLETYPE  a_BlockMeta 
)
void cBlockArea::SetRelBlockSkyLight ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
NIBBLETYPE  a_BlockSkyLight 
)
void cBlockArea::SetRelBlockType ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
BLOCKTYPE  a_BlockType 
)
void cBlockArea::SetRelBlockTypeMeta ( int  a_RelX,
int  a_RelY,
int  a_RelZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
bool cBlockArea::Write ( cWorld a_World,
int  a_MinBlockX,
int  a_MinBlockY,
int  a_MinBlockZ,
int  a_DataTypes = baTypes|baMetas 
)

Writes the area back into cWorld at the coords specified. Returns true if successful in all chunks, false if only partially / not at all.