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

#include <BlockButton.h>

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

Static Public Member Functions

static bool IsButtonOn (NIBBLETYPE a_Meta)
 Extracts the ON bit from metadata and returns if true if it is set. More...
 
static void OnArrowHit (cWorld &a_World, const Vector3i a_Position, const eBlockFace a_HitFace)
 Event handler for an arrow striking a block. More...
 

Private Types

using Super = cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true > >
 

Private Member Functions

virtual bool CanBeAt (const cChunk &a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
 
virtual ColourID GetMapBaseColourID (NIBBLETYPE a_Meta) const override
 
virtual bool IsUseable (void) const override
 
virtual bool OnUse (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const Vector3i a_BlockPos, eBlockFace a_BlockFace, const Vector3i a_CursorPos) const override
 

Static Private Member Functions

static eBlockFace BlockMetaDataToBlockFace (NIBBLETYPE a_Meta)
 Converts the block meta of this button into a block face of the neighbor to which the button is attached. More...
 
static Vector3d GetButtonOffsetOnBlock (NIBBLETYPE a_Meta)
 Returns an offset to the integer world coordinates of a button. More...
 
static bool IsButtonPressedByArrow (cWorld &a_World, const Vector3i a_ButtonPosition, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_Meta)
 Returns true if an arrow was found in the wooden button. More...
 
static void QueueButtonRelease (cWorld &a_ButtonWorld, const Vector3i a_Position, const BLOCKTYPE a_BlockType)
 Schedules a recurring event at appropriate intervals to release a button at a given position. More...
 

Additional Inherited Members

- Public Member Functions inherited from cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true > >
constexpr cClearMetaOnDrop (BLOCKTYPE a_BlockType)
 
- Public Member Functions inherited from cMetaRotator< Base, BitMask, North, East, South, West, AssertIfNotMatched >
constexpr cMetaRotator (BLOCKTYPE a_BlockType)
 
- Protected Member Functions inherited from cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true > >
 ~cClearMetaOnDrop ()=default
 
- Protected Member Functions inherited from cMetaRotator< Base, BitMask, North, East, South, West, AssertIfNotMatched >
virtual NIBBLETYPE MetaMirrorXY (NIBBLETYPE a_Meta) const override
 
virtual NIBBLETYPE MetaMirrorYZ (NIBBLETYPE a_Meta) const override
 
virtual NIBBLETYPE MetaRotateCCW (NIBBLETYPE a_Meta) const override
 
virtual NIBBLETYPE MetaRotateCW (NIBBLETYPE a_Meta) const override
 
 ~cMetaRotator ()=default
 

Detailed Description

Definition at line 17 of file BlockButton.h.

Member Typedef Documentation

◆ Super

using cBlockButtonHandler::Super = cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true> >
private

Definition at line 20 of file BlockButton.h.

Member Function Documentation

◆ BlockMetaDataToBlockFace()

static eBlockFace cBlockButtonHandler::BlockMetaDataToBlockFace ( NIBBLETYPE  a_Meta)
inlinestaticprivate

Converts the block meta of this button into a block face of the neighbor to which the button is attached.

Definition at line 110 of file BlockButton.h.

◆ CanBeAt()

virtual bool cBlockButtonHandler::CanBeAt ( const cChunk a_Chunk,
const Vector3i  a_Position,
const NIBBLETYPE  a_Meta 
) const
inlineoverrideprivatevirtual

Definition at line 132 of file BlockButton.h.

◆ GetButtonOffsetOnBlock()

static Vector3d cBlockButtonHandler::GetButtonOffsetOnBlock ( NIBBLETYPE  a_Meta)
inlinestaticprivate

Returns an offset to the integer world coordinates of a button.

Applying this offset yields the centre of the button's bounding box, in terms of the position within the block the button with given meta occupies.

TODO: this is only approximate, return the exact bbox instead.

Definition at line 248 of file BlockButton.h.

◆ GetMapBaseColourID()

virtual ColourID cBlockButtonHandler::GetMapBaseColourID ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

Definition at line 179 of file BlockButton.h.

◆ IsButtonOn()

static bool cBlockButtonHandler::IsButtonOn ( NIBBLETYPE  a_Meta)
inlinestatic

Extracts the ON bit from metadata and returns if true if it is set.

Definition at line 27 of file BlockButton.h.

◆ IsButtonPressedByArrow()

static bool cBlockButtonHandler::IsButtonPressedByArrow ( cWorld a_World,
const Vector3i  a_ButtonPosition,
const BLOCKTYPE  a_BlockType,
const NIBBLETYPE  a_Meta 
)
inlinestaticprivate

Returns true if an arrow was found in the wooden button.

Definition at line 224 of file BlockButton.h.

◆ IsUseable()

virtual bool cBlockButtonHandler::IsUseable ( void  ) const
inlineoverrideprivatevirtual

Definition at line 100 of file BlockButton.h.

◆ OnArrowHit()

static void cBlockButtonHandler::OnArrowHit ( cWorld a_World,
const Vector3i  a_Position,
const eBlockFace  a_HitFace 
)
inlinestatic

Event handler for an arrow striking a block.

Performs appropriate handling if the arrow intersected a wooden button.

Definition at line 34 of file BlockButton.h.

◆ OnUse()

virtual bool cBlockButtonHandler::OnUse ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
const Vector3i  a_BlockPos,
eBlockFace  a_BlockFace,
const Vector3i  a_CursorPos 
) const
inlineoverrideprivatevirtual

Definition at line 64 of file BlockButton.h.

◆ QueueButtonRelease()

static void cBlockButtonHandler::QueueButtonRelease ( cWorld a_ButtonWorld,
const Vector3i  a_Position,
const BLOCKTYPE  a_BlockType 
)
inlinestaticprivate

Schedules a recurring event at appropriate intervals to release a button at a given position.

The given block type is checked when the task is executed to ensure the position still contains a button.

Definition at line 187 of file BlockButton.h.


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