diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-05-05 15:25:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 15:25:10 +0200 |
commit | a62b2b1be2103d7de2fd66c7304b7473e369be3c (patch) | |
tree | a44f2b43fd90f5c79af5e308b554349e6dc546af /src/Blocks/Mixins.h | |
parent | Rename files to match code (diff) | |
download | cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.gz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.bz2 cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.lz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.xz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.zst cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.zip |
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); - } }; |