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

#include <BlockVine.h>

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

Public Member Functions

 cBlockVineHandler (BLOCKTYPE a_BlockType)
 
virtual void Check (cChunkInterface &a_ChunkInterface, cBlockPluginInterface &a_PluginInterface, Vector3i a_RelPos, cChunk &a_Chunk) override
 Called when one of the neighbors gets set; equivalent to MC block update. More...
 
virtual cItems ConvertToPickups (NIBBLETYPE a_BlockMeta, cBlockEntity *a_BlockEntity, const cEntity *a_Digger, const cItem *a_Tool) override
 Returns the pickups that would result if the block was mined by a_Digger using a_Tool. More...
 
virtual bool DoesDropOnUnsuitable (void) override
 Returns if this block drops if it gets destroyed by an unsuitable situation. More...
 
virtual bool DoesIgnoreBuildCollision (cChunkInterface &a_ChunkInterface, Vector3i a_Pos, cPlayer &a_Player, NIBBLETYPE a_Meta) override
 Checks if the player can build "inside" this block. More...
 
virtual ColourID GetMapBaseColourID (NIBBLETYPE a_Meta) override
 Returns the base colour ID of the block, as will be represented on a map, as per documentation: https://minecraft.gamepedia.com/Map_item_format. More...
 
NIBBLETYPE GetMaxMeta (cChunk &a_Chunk, Vector3i a_RelPos)
 Returns the meta that has the maximum allowable sides of the vine, given the surroundings. More...
 
virtual bool GetPlacementBlockTypeMeta (cChunkInterface &a_ChunkInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) override
 Called before a block is placed into a world. More...
 
virtual NIBBLETYPE MetaMirrorXY (NIBBLETYPE a_Meta) override
 Mirrors a given block meta around the XY plane. More...
 
virtual NIBBLETYPE MetaMirrorYZ (NIBBLETYPE a_Meta) override
 Mirros a given block meta around the YZ plane. More...
 
virtual NIBBLETYPE MetaRotateCCW (NIBBLETYPE a_Meta) override
 Rotates a given block meta counter-clockwise. More...
 
virtual NIBBLETYPE MetaRotateCW (NIBBLETYPE a_Meta) override
 Rotates a given block meta clockwise. More...
 
virtual void OnUpdate (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cBlockPluginInterface &a_BlockPluginInterface, cChunk &a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
 Called when the block gets ticked either by a random tick or by a queued tick. More...
 
- Public Member Functions inherited from cBlockHandler
virtual bool CanBeAt (cChunkInterface &a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk &a_Chunk)
 Checks if the block can stay at the specified relative coords in the chunk. More...
 
virtual bool CanSustainPlant (BLOCKTYPE a_Plant)
 Checks whether the block has an effect on growing the plant. More...
 
 cBlockHandler (BLOCKTYPE a_BlockType)
 
virtual cBoundingBox GetPlacementCollisionBox (BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP)
 Returns the relative bounding box that must be entity-free in order for the block to be placed. More...
 
virtual int Grow (cChunk &a_Chunk, Vector3i a_RelPos, int a_NumStages=1)
 Grows this block, if it supports growing, by the specified amount of stages (at most). More...
 
virtual bool IsClickedThrough (void)
 Indicates whether the client will click through this block. More...
 
virtual bool IsInsideBlock (Vector3d a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
 Tests if a_Position is inside the block where a_Position is relative to the origin of the block Note that this is considered from a "top-down" perspective i.e. More...
 
virtual bool IsUseable (void)
 Checks if the block can be placed at this point. More...
 
virtual NIBBLETYPE MetaMirrorXZ (NIBBLETYPE a_Meta)
 Mirros a given block meta around the XZ plane. More...
 
virtual void OnBreaking (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos)
 Called before a block gets broken (replaced with air), either by player or by natural means. More...
 
virtual void OnBroken (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta)
 Called after a block gets broken (replaced with air), either by player or by natural means. More...
 
virtual void OnCancelRightClick (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
 Called when a right click to this block is cancelled. More...
 
virtual void OnDigging (cChunkInterface &cChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Called when the player starts digging the block. More...
 
virtual void OnNeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
 Called when a direct neighbor of this block has been changed. More...
 
virtual void OnPlaced (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Called by cWorld::SetBlock() after the block has been set. More...
 
virtual void OnPlacedByPlayer (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const sSetBlock &a_BlockChange)
 Called by cPlayer::PlaceBlocks() for each block after it has been set to the world. More...
 
virtual void OnPlayerBreakingBlock (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, Vector3i a_BlockPos)
 Called just before the player breaks the block. More...
 
virtual void OnPlayerBrokeBlock (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta)
 Called just after the player breaks the block. More...
 
virtual bool OnUse (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
 Called if the user right clicks the block and the block is useable returns true if the use was successful, return false to use the block as a "normal" block. More...
 
virtual ~cBlockHandler ()
 

Static Public Member Functions

static NIBBLETYPE DirectionToMetaData (char a_BlockFace)
 
static bool IsBlockAttachable (BLOCKTYPE a_BlockType)
 Returns true if the specified block type is good for vines to attach to. More...
 
static char MetaDataToDirection (NIBBLETYPE a_MetaData)
 
- Static Public Member Functions inherited from cBlockHandler
static void NeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_NeighborPos, eBlockFace a_WhichNeighbor)
 Notifies the specified neighbor that the current block has changed. More...
 
static bool ToolHasSilkTouch (const cItem *a_Tool)
 Returns true if the specified tool is valid and has a non-zero silk-touch enchantment. More...
 

Private Types

using super = cBlockHandler
 

Additional Inherited Members

- Static Protected Member Functions inherited from cBlockHandler
static cBlockHandlerCreateBlockHandler (BLOCKTYPE a_BlockType)
 
- Protected Attributes inherited from cBlockHandler
BLOCKTYPE m_BlockType
 

Detailed Description

Definition at line 9 of file BlockVine.h.

Member Typedef Documentation

Definition at line 12 of file BlockVine.h.

Constructor & Destructor Documentation

cBlockVineHandler::cBlockVineHandler ( BLOCKTYPE  a_BlockType)
inline

Definition at line 16 of file BlockVine.h.

Member Function Documentation

virtual void cBlockVineHandler::Check ( cChunkInterface ChunkInterface,
cBlockPluginInterface a_PluginInterface,
Vector3i  a_RelPos,
cChunk a_Chunk 
)
inlineoverridevirtual

Called when one of the neighbors gets set; equivalent to MC block update.

By default drops (DropBlockAsPickup() / SetBlock()) if the position is no longer suitable (CanBeAt(), DoesDropOnUnsuitable()), otherwise wakes up all simulators on the block.

Reimplemented from cBlockHandler.

Definition at line 163 of file BlockVine.h.

virtual cItems cBlockVineHandler::ConvertToPickups ( NIBBLETYPE  a_BlockMeta,
cBlockEntity a_BlockEntity,
const cEntity a_Digger,
const cItem a_Tool 
)
inlineoverridevirtual

Returns the pickups that would result if the block was mined by a_Digger using a_Tool.

Doesn't do any actual block change / mining, only calculates the pickups. a_BlockEntity is the block entity present at the block, if any, nullptr if none. a_Digger is the entity that caused the conversion, usually the player digging. a_Tool is the tool used for the digging. The default implementation drops a single item created from m_BlockType and the current meta.

Reimplemented from cBlockHandler.

Definition at line 52 of file BlockVine.h.

static NIBBLETYPE cBlockVineHandler::DirectionToMetaData ( char  a_BlockFace)
inlinestatic

Definition at line 66 of file BlockVine.h.

virtual bool cBlockVineHandler::DoesDropOnUnsuitable ( void  )
inlineoverridevirtual

Returns if this block drops if it gets destroyed by an unsuitable situation.

Default: true

Reimplemented from cBlockHandler.

Definition at line 215 of file BlockVine.h.

virtual bool cBlockVineHandler::DoesIgnoreBuildCollision ( cChunkInterface ChunkInterface,
Vector3i  a_Pos,
cPlayer a_Player,
NIBBLETYPE  a_Meta 
)
inlineoverridevirtual

Checks if the player can build "inside" this block.

For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision

Parameters
a_PosPosition of the block
a_PlayerPlayer trying to build on the block
a_MetaMeta value of the block currently at a_Pos

Reimplemented from cBlockHandler.

Definition at line 206 of file BlockVine.h.

virtual ColourID cBlockVineHandler::GetMapBaseColourID ( NIBBLETYPE  a_Meta)
inlineoverridevirtual

Returns the base colour ID of the block, as will be represented on a map, as per documentation: https://minecraft.gamepedia.com/Map_item_format.

Reimplemented from cBlockHandler.

Definition at line 289 of file BlockVine.h.

NIBBLETYPE cBlockVineHandler::GetMaxMeta ( cChunk a_Chunk,
Vector3i  a_RelPos 
)
inline

Returns the meta that has the maximum allowable sides of the vine, given the surroundings.

Definition at line 129 of file BlockVine.h.

virtual bool cBlockVineHandler::GetPlacementBlockTypeMeta ( cChunkInterface a_ChunkInterface,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ,
BLOCKTYPE a_BlockType,
NIBBLETYPE a_BlockMeta 
)
inlineoverridevirtual

Called before a block is placed into a world.

The handler should return true to allow placement, false to refuse. Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block. Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block

Reimplemented from cBlockHandler.

Definition at line 25 of file BlockVine.h.

static bool cBlockVineHandler::IsBlockAttachable ( BLOCKTYPE  a_BlockType)
inlinestatic

Returns true if the specified block type is good for vines to attach to.

Definition at line 99 of file BlockVine.h.

static char cBlockVineHandler::MetaDataToDirection ( NIBBLETYPE  a_MetaData)
inlinestatic

Definition at line 82 of file BlockVine.h.

virtual NIBBLETYPE cBlockVineHandler::MetaMirrorXY ( NIBBLETYPE  a_Meta)
inlineoverridevirtual

Mirrors a given block meta around the XY plane.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 269 of file BlockVine.h.

virtual NIBBLETYPE cBlockVineHandler::MetaMirrorYZ ( NIBBLETYPE  a_Meta)
inlineoverridevirtual

Mirros a given block meta around the YZ plane.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 279 of file BlockVine.h.

virtual NIBBLETYPE cBlockVineHandler::MetaRotateCCW ( NIBBLETYPE  a_Meta)
inlineoverridevirtual

Rotates a given block meta counter-clockwise.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 251 of file BlockVine.h.

virtual NIBBLETYPE cBlockVineHandler::MetaRotateCW ( NIBBLETYPE  a_Meta)
inlineoverridevirtual

Rotates a given block meta clockwise.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 260 of file BlockVine.h.

virtual void cBlockVineHandler::OnUpdate ( cChunkInterface cChunkInterface,
cWorldInterface a_WorldInterface,
cBlockPluginInterface a_BlockPluginInterface,
cChunk a_Chunk,
int  a_RelX,
int  a_RelY,
int  a_RelZ 
)
inlineoverridevirtual

Called when the block gets ticked either by a random tick or by a queued tick.

Note that the coords are chunk-relative!

Reimplemented from cBlockHandler.

Definition at line 224 of file BlockVine.h.


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