20 #pragma warning(disable: 4127)
48 return cItem(this->m_BlockType);
59 template <
class Base, NIBBLETYPE BitMask, NIBBLETYPE North, NIBBLETYPE East, NIBBLETYPE South, NIBBLETYPE West,
bool AssertIfNotMatched = false>
77 switch (a_Meta & BitMask)
84 if (AssertIfNotMatched)
86 ASSERT(!
"Invalid Meta value");
98 switch (a_Meta & BitMask)
105 if (AssertIfNotMatched)
107 ASSERT(!
"Invalid Meta value");
119 switch (a_Meta & BitMask)
135 switch (a_Meta & BitMask)
158 bool AssertIfNotMatched =
false
161 public cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatched>
174 if ((a_Rotation >= -135) && (a_Rotation < -45))
178 else if ((a_Rotation >= -45) && (a_Rotation < 45))
182 else if ((a_Rotation >= 45) && (a_Rotation < 135))
214 public cYawRotator<Base, BitMask, North, East, South, West>
228 const auto Displacement = a_EyePosition - a_PlacePosition.
addedXZ(0.5, 0.5);
229 (std::abs(Displacement.x) < 2) && (std::abs(Displacement.z) < 2)
232 if (Displacement.y > 2)
237 if (Displacement.y < 0)
254 switch (a_Meta & BitMask)
256 case Down:
return Up | OtherMeta;
257 case Up:
return Down | OtherMeta;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
bool Up(const BlockState Block)
bool Down(const BlockState Block)
Mixin to clear the block's meta value when converting to a pickup.
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
~cClearMetaOnDrop()=default
constexpr cClearMetaOnDrop(BLOCKTYPE a_BlockType)
Mixin for rotations and reflections following the standard pattern of "apply mask,...
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) const override
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) const override
constexpr cMetaRotator(BLOCKTYPE a_BlockType)
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) const override
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) const override
Mixin for blocks whose meta on placement depends on the yaw of the player placing the block.
cMetaRotator< Base, BitMask, North, East, South, West, AssertIfNotMatched > Super
static NIBBLETYPE YawToMetaData(double a_Rotation)
Converts the rotation value as returned by cPlayer::GetYaw() to the appropriate metadata value for a ...
Mixin for blocks whose meta on placement depends on the relative position of the player to the block ...
~cDisplacementYawRotator()=default
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) const override
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(),...
This class bridges a vector of cItem for safe access via Lua.
Vector3< T > addedXZ(T a_AddX, T a_AddZ) const
Returns a copy of this vector moved by the specified amount on the X and Z axes.