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

#include <BlockPiston.h>

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

Static Public Member Functions

static void ExtendPiston (Vector3i a_BlockPos, cWorld &a_World)
 
static bool IsExtended (NIBBLETYPE a_PistonMeta)
 Returns true if the piston (with the specified meta) is extended. More...
 
static eBlockFace MetaDataToDirection (NIBBLETYPE a_MetaData)
 
static Vector3i MetadataToOffset (NIBBLETYPE a_PistonMeta)
 Converts piston block's metadata into a unit vector representing the direction in which the piston will extend. More...
 
static void RetractPiston (Vector3i a_BlockPos, cWorld &a_World)
 
- Static Public Member Functions inherited from cDisplacementYawRotator< Base, BitMask, North, East, South, West, Up, Down >
static NIBBLETYPE DisplacementYawToMetaData (const Vector3d a_PlacePosition, const Vector3d a_EyePosition, const double a_Rotation)
 Converts the placement position, eye position as returned by cPlayer::GetEyePosition(), and rotation value as returned by cPlayer::GetYaw() to the appropriate metadata value for a block placed by a player facing that way. More...
 
- Static Public Member Functions inherited from cYawRotator< Base, 0x07, 0x02, 0x05, 0x03, 0x04 >
static NIBBLETYPE YawToMetaData (double a_Rotation)
 Converts the rotation value as returned by cPlayer::GetYaw() to the appropriate metadata value for a block placed by a player facing that way. More...
 

Private Types

using Super = cClearMetaOnDrop< cDisplacementYawRotator< cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00 > >
 
typedef std::unordered_set< Vector3i, VectorHasher< int > > Vector3iSet
 

Private Member Functions

virtual ColourID GetMapBaseColourID (NIBBLETYPE a_Meta) const override
 
virtual void OnBroken (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta, const cEntity *a_Digger) const override
 

Static Private Member Functions

static bool CanPush (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Returns true if the specified block can be pushed by a piston (and left intact) More...
 
static bool CanPushBlock (const Vector3i &a_BlockPos, cWorld &a_World, bool a_RequirePushable, Vector3iSet &a_BlocksPushed, const Vector3i &a_PushDir)
 Tries to push a block and increases the pushed blocks variable. More...
 
static bool IsSticky (BLOCKTYPE a_BlockType)
 Returns true if the piston (specified by blocktype) is a sticky piston. More...
 
static void PushBlocks (const Vector3iSet &a_BlocksToPush, cWorld &a_World, const Vector3i &a_PushDir)
 Moves a list of blocks in a specific direction. More...
 

Static Private Attributes

static const Byte PistonExtendAction = 0U
 Piston extension block action. More...
 
static const Byte PistonRetractAction = 1U
 Piston retraction block action. More...
 

Additional Inherited Members

- Public Member Functions inherited from cClearMetaOnDrop< cDisplacementYawRotator< cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00 > >
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< cDisplacementYawRotator< cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00 > >
 ~cClearMetaOnDrop ()=default
 
- Protected Member Functions inherited from cDisplacementYawRotator< Base, BitMask, North, East, South, West, Up, Down >
virtual NIBBLETYPE MetaMirrorXZ (NIBBLETYPE a_Meta) const override
 
 ~cDisplacementYawRotator ()=default
 
- Protected Member Functions inherited from cYawRotator< Base, 0x07, 0x02, 0x05, 0x03, 0x04 >
 ~cYawRotator ()=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 18 of file BlockPiston.h.

Member Typedef Documentation

◆ Super

using cBlockPistonHandler::Super = cClearMetaOnDrop<cDisplacementYawRotator<cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00> >
private

Definition at line 21 of file BlockPiston.h.

◆ Vector3iSet

typedef std::unordered_set<Vector3i, VectorHasher<int> > cBlockPistonHandler::Vector3iSet
private

Definition at line 56 of file BlockPiston.h.

Member Function Documentation

◆ CanPush()

static bool cBlockPistonHandler::CanPush ( BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inlinestaticprivate

Returns true if the specified block can be pushed by a piston (and left intact)

Definition at line 68 of file BlockPiston.h.

◆ CanPushBlock()

bool cBlockPistonHandler::CanPushBlock ( const Vector3i a_BlockPos,
cWorld a_World,
bool  a_RequirePushable,
Vector3iSet a_BlocksPushed,
const Vector3i a_PushDir 
)
staticprivate

Tries to push a block and increases the pushed blocks variable.

Returns true if the block is pushable

Definition at line 213 of file BlockPiston.cpp.

◆ ExtendPiston()

void cBlockPistonHandler::ExtendPiston ( Vector3i  a_BlockPos,
cWorld a_World 
)
static

Definition at line 44 of file BlockPiston.cpp.

◆ GetMapBaseColourID()

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

Definition at line 122 of file BlockPiston.h.

◆ IsExtended()

static bool cBlockPistonHandler::IsExtended ( NIBBLETYPE  a_PistonMeta)
inlinestatic

Returns true if the piston (with the specified meta) is extended.

Definition at line 52 of file BlockPiston.h.

◆ IsSticky()

static bool cBlockPistonHandler::IsSticky ( BLOCKTYPE  a_BlockType)
inlinestaticprivate

Returns true if the piston (specified by blocktype) is a sticky piston.

Definition at line 65 of file BlockPiston.h.

◆ MetaDataToDirection()

static eBlockFace cBlockPistonHandler::MetaDataToDirection ( NIBBLETYPE  a_MetaData)
inlinestatic

Definition at line 27 of file BlockPiston.h.

◆ MetadataToOffset()

Vector3i cBlockPistonHandler::MetadataToOffset ( NIBBLETYPE  a_PistonMeta)
static

Converts piston block's metadata into a unit vector representing the direction in which the piston will extend.

Definition at line 21 of file BlockPiston.cpp.

◆ OnBroken()

void cBlockPistonHandler::OnBroken ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos,
BLOCKTYPE  a_OldBlockType,
NIBBLETYPE  a_OldBlockMeta,
const cEntity a_Digger 
) const
overrideprivatevirtual

Definition at line 287 of file BlockPiston.cpp.

◆ PushBlocks()

void cBlockPistonHandler::PushBlocks ( const Vector3iSet a_BlocksToPush,
cWorld a_World,
const Vector3i a_PushDir 
)
staticprivate

Moves a list of blocks in a specific direction.

Definition at line 174 of file BlockPiston.cpp.

◆ RetractPiston()

void cBlockPistonHandler::RetractPiston ( Vector3i  a_BlockPos,
cWorld a_World 
)
static

Definition at line 102 of file BlockPiston.cpp.

Member Data Documentation

◆ PistonExtendAction

const Byte cBlockPistonHandler::PistonExtendAction = 0U
staticprivate

Piston extension block action.

Definition at line 59 of file BlockPiston.h.

◆ PistonRetractAction

const Byte cBlockPistonHandler::PistonRetractAction = 1U
staticprivate

Piston retraction block action.

Definition at line 62 of file BlockPiston.h.


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