Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Attributes | List of all members
cChunkInterface Class Reference

#include <ChunkInterface.h>

Inheritance diagram for cChunkInterface:
Inheritance graph
[legend]
Collaboration diagram for cChunkInterface:
Collaboration graph
[legend]

Public Member Functions

 cChunkInterface (cChunkMap *a_ChunkMap)
 
bool DigBlock (cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, cEntity *a_Digger)
 
bool DoWithChunkAt (Vector3i a_BlockPos, cFunctionRef< bool(cChunk &)> a_Callback)
 
void DropBlockAsPickups (Vector3i a_BlockPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
 Digs the block and spawns the relevant pickups, as if a_Digger used a_Tool to dig the block. More...
 
void FastSetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Sets the block at the specified coords to the specified value. More...
 
virtual bool ForEachChunkInRect (int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback &a_Callback) override
 Calls the callback for each chunk in the specified range. More...
 
BLOCKTYPE GetBlock (Vector3i a_Pos)
 
NIBBLETYPE GetBlockMeta (Vector3i a_Pos)
 
bool GetBlockTypeMeta (Vector3i a_Pos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
 
void SetBlock (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 OBSOLETE, use the Vector3i-based overload instead. More...
 
void SetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Sets the block at the specified coords to the specified value. More...
 
void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData)
 OBSOLETE, Use the Vector3-based overload instead. More...
 
void SetBlockMeta (Vector3i a_BlockPos, NIBBLETYPE a_MetaData)
 Sets the meta for the specified block, while keeping the blocktype. More...
 
bool UseBlockEntity (cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Use block entity on coordinate. More...
 
virtual bool WriteBlockArea (cBlockArea &a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override
 Writes the block area into the specified coords. More...
 
- Public Member Functions inherited from cForEachChunkProvider
virtual ~cForEachChunkProvider ()
 

Private Attributes

cChunkMapm_ChunkMap
 

Detailed Description

Definition at line 21 of file ChunkInterface.h.

Constructor & Destructor Documentation

◆ cChunkInterface()

cChunkInterface::cChunkInterface ( cChunkMap a_ChunkMap)
inline

Definition at line 26 of file ChunkInterface.h.

Member Function Documentation

◆ DigBlock()

bool cChunkInterface::DigBlock ( cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos,
cEntity a_Digger 
)

Definition at line 104 of file ChunkInterface.cpp.

◆ DoWithChunkAt()

bool cChunkInterface::DoWithChunkAt ( Vector3i  a_BlockPos,
cFunctionRef< bool(cChunk &)>  a_Callback 
)

Definition at line 14 of file ChunkInterface.cpp.

◆ DropBlockAsPickups()

void cChunkInterface::DropBlockAsPickups ( Vector3i  a_BlockPos,
const cEntity a_Digger = nullptr,
const cItem a_Tool = nullptr 
)

Digs the block and spawns the relevant pickups, as if a_Digger used a_Tool to dig the block.

Definition at line 123 of file ChunkInterface.cpp.

◆ FastSetBlock()

void cChunkInterface::FastSetBlock ( Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Sets the block at the specified coords to the specified value.

The replacement doesn't trigger block updates. The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block).

Definition at line 68 of file ChunkInterface.cpp.

◆ ForEachChunkInRect()

bool cChunkInterface::ForEachChunkInRect ( int  a_MinChunkX,
int  a_MaxChunkX,
int  a_MinChunkZ,
int  a_MaxChunkZ,
cChunkDataCallback &  a_Callback 
)
overridevirtual

Calls the callback for each chunk in the specified range.

Implements cForEachChunkProvider.

Definition at line 86 of file ChunkInterface.cpp.

◆ GetBlock()

BLOCKTYPE cChunkInterface::GetBlock ( Vector3i  a_Pos)

Definition at line 23 of file ChunkInterface.cpp.

◆ GetBlockMeta()

NIBBLETYPE cChunkInterface::GetBlockMeta ( Vector3i  a_Pos)

Definition at line 32 of file ChunkInterface.cpp.

◆ GetBlockTypeMeta()

bool cChunkInterface::GetBlockTypeMeta ( Vector3i  a_Pos,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_BlockMeta 
)

Definition at line 41 of file ChunkInterface.cpp.

◆ SetBlock() [1/2]

void cChunkInterface::SetBlock ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inline

OBSOLETE, use the Vector3i-based overload instead.

Sets the block at the specified coords to the specified value. Full processing, incl. updating neighbors, is performed.

Definition at line 42 of file ChunkInterface.h.

◆ SetBlock() [2/2]

void cChunkInterface::SetBlock ( Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)

Sets the block at the specified coords to the specified value.

Full processing, incl. updating neighbors, is performed.

Definition at line 50 of file ChunkInterface.cpp.

◆ SetBlockMeta() [1/2]

void cChunkInterface::SetBlockMeta ( int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
NIBBLETYPE  a_MetaData 
)
inline

OBSOLETE, Use the Vector3-based overload instead.

Sets the meta for the specified block, while keeping the blocktype. Ignored if the chunk is invalid.

Definition at line 54 of file ChunkInterface.h.

◆ SetBlockMeta() [2/2]

void cChunkInterface::SetBlockMeta ( Vector3i  a_BlockPos,
NIBBLETYPE  a_MetaData 
)

Sets the meta for the specified block, while keeping the blocktype.

Ignored if the chunk is invalid.

Definition at line 59 of file ChunkInterface.cpp.

◆ UseBlockEntity()

bool cChunkInterface::UseBlockEntity ( cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)

Use block entity on coordinate.

returns true if the use was successful, return false to use the block as a "normal" block

Definition at line 77 of file ChunkInterface.cpp.

◆ WriteBlockArea()

bool cChunkInterface::WriteBlockArea ( cBlockArea a_Area,
int  a_MinBlockX,
int  a_MinBlockY,
int  a_MinBlockZ,
int  a_DataTypes 
)
overridevirtual

Writes the block area into the specified coords.

Returns true if all chunks have been processed. a_DataTypes is a bitmask of cBlockArea::baXXX constants ORed together.

Implements cForEachChunkProvider.

Definition at line 95 of file ChunkInterface.cpp.

Member Data Documentation

◆ m_ChunkMap

cChunkMap* cChunkInterface::m_ChunkMap
private

Definition at line 79 of file ChunkInterface.h.


The documentation for this class was generated from the following files: