diff options
Diffstat (limited to 'src/Blocks/Mixins.h')
-rw-r--r-- | src/Blocks/Mixins.h | 70 |
1 files changed, 12 insertions, 58 deletions
diff --git a/src/Blocks/Mixins.h b/src/Blocks/Mixins.h index 42b437ba7..23a4be225 100644 --- a/src/Blocks/Mixins.h +++ b/src/Blocks/Mixins.h @@ -167,27 +167,6 @@ public: using Super::Super; - virtual bool GetPlacementBlockTypeMeta( - cChunkInterface & a_ChunkInterface, cPlayer & a_Player, - const Vector3i a_BlockPos, - eBlockFace a_BlockFace, - const Vector3i a_CursorPos, - BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) const override - { - NIBBLETYPE BaseMeta; - if (!Super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockPos, a_BlockFace, a_CursorPos, a_BlockType, BaseMeta)) - { - return false; - } - - a_BlockMeta = (BaseMeta & ~BitMask) | YawToMetaData(a_Player.GetYaw()); - return true; - } - - - - /** Converts the rotation value as returned by cPlayer::GetYaw() to the appropriate metadata value for a block placed by a player facing that way */ @@ -241,31 +220,26 @@ public: using Super::Super; -protected: - - ~cPitchYawRotator() = default; - virtual bool GetPlacementBlockTypeMeta( - cChunkInterface & a_ChunkInterface, - cPlayer & a_Player, - const Vector3i a_PlacedBlockPos, - eBlockFace a_ClickedBlockFace, - const Vector3i a_CursorPos, - BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta - ) const override + /** Converts the rotation and pitch values as returned by cPlayer::GetYaw() and cPlayer::GetPitch() + respectively to the appropriate metadata value for a block placed by a player facing that way */ + static NIBBLETYPE PitchYawToMetaData(double a_Rotation, double a_Pitch) { - NIBBLETYPE BaseMeta; - if (!Super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_PlacedBlockPos, a_ClickedBlockFace, a_CursorPos, a_BlockType, BaseMeta)) + if (a_Pitch >= 50) { - return false; + return Up; + } + else if (a_Pitch <= -50) + { + return Down; } - a_BlockMeta = (BaseMeta & ~BitMask) | PitchYawToMetaData(a_Player.GetYaw(), a_Player.GetPitch()); - return true; + return Super::YawToMetaData(a_Rotation); } +protected: - + ~cPitchYawRotator() = default; virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) const override @@ -279,24 +253,4 @@ protected: // Not Facing Up or Down; No change. return a_Meta; } - - - - - - /** Converts the rotation and pitch values as returned by cPlayer::GetYaw() and cPlayer::GetPitch() - respectively to the appropriate metadata value for a block placed by a player facing that way */ - static NIBBLETYPE PitchYawToMetaData(double a_Rotation, double a_Pitch) - { - if (a_Pitch >= 50) - { - return Up; - } - else if (a_Pitch <= -50) - { - return Down; - } - - return Super::YawToMetaData(a_Rotation); - } }; |