summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockSignPost.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-20 15:50:52 +0200
committerGitHub <noreply@github.com>2020-09-20 15:50:52 +0200
commit68cced73afe546328cf94ed07c57deee47bfadec (patch)
tree88be88e3fd4a208b9849e526f1877caa44058ab5 /src/Blocks/BlockSignPost.h
parentAdded armor and shulker box cleaning (#4875) (diff)
downloadcuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.gz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.bz2
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.lz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.xz
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.tar.zst
cuberite-68cced73afe546328cf94ed07c57deee47bfadec.zip
Diffstat (limited to 'src/Blocks/BlockSignPost.h')
-rw-r--r--src/Blocks/BlockSignPost.h48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/Blocks/BlockSignPost.h b/src/Blocks/BlockSignPost.h
index f493cb355..717a85ecf 100644
--- a/src/Blocks/BlockSignPost.h
+++ b/src/Blocks/BlockSignPost.h
@@ -15,15 +15,25 @@ class cBlockSignPostHandler:
public:
- cBlockSignPostHandler(BLOCKTYPE a_BlockType):
- Super(a_BlockType)
+ using Super::Super;
+
+ /** Converts the (player) rotation to placed-signpost block meta. */
+ static NIBBLETYPE RotationToMetaData(double a_Rotation)
{
- }
+ a_Rotation += 180 + (180 / 16); // So it's not aligned with axis
+ if (a_Rotation > 360)
+ {
+ a_Rotation -= 360;
+ }
+ a_Rotation = (a_Rotation / 360) * 16;
+ return (static_cast<char>(a_Rotation)) % 16;
+ }
+private:
- virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
+ virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) const override
{
return cItem(E_ITEM_SIGN, 1, 0);
}
@@ -32,7 +42,7 @@ public:
- virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) override
+ virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
{
if (a_RelPos.y <= 0)
{
@@ -46,25 +56,7 @@ public:
- /** Converts the (player) rotation to placed-signpost block meta. */
- static NIBBLETYPE RotationToMetaData(double a_Rotation)
- {
- a_Rotation += 180 + (180 / 16); // So it's not aligned with axis
- if (a_Rotation > 360)
- {
- a_Rotation -= 360;
- }
-
- a_Rotation = (a_Rotation / 360) * 16;
-
- return (static_cast<char>(a_Rotation)) % 16;
- }
-
-
-
-
-
- virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
+ virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) const override
{
return (a_Meta + 4) & 0x0f;
}
@@ -73,7 +65,7 @@ public:
- virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
+ virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) const override
{
return (a_Meta + 12) & 0x0f;
}
@@ -82,7 +74,7 @@ public:
- virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
+ virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) const override
{
// Mirrors signs over the XY plane (North-South Mirroring)
@@ -95,7 +87,7 @@ public:
- virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
+ virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) const override
{
// Mirrors signs over the YZ plane (East-West Mirroring)
@@ -108,7 +100,7 @@ public:
- virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
+ virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
{
UNUSED(a_Meta);
return 13;