summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockAnvil.h24
-rw-r--r--src/Blocks/BlockChest.h4
-rw-r--r--src/Blocks/BlockDoor.h4
-rw-r--r--src/Blocks/BlockDropSpenser.h4
-rw-r--r--src/Blocks/BlockFurnace.h4
-rw-r--r--src/Blocks/BlockPiston.h4
-rw-r--r--src/Blocks/BlockPumpkin.h4
-rw-r--r--src/Blocks/Mixins.h14
8 files changed, 31 insertions, 31 deletions
diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h
index 2252c7ded..da242fdb7 100644
--- a/src/Blocks/BlockAnvil.h
+++ b/src/Blocks/BlockAnvil.h
@@ -2,6 +2,7 @@
#pragma once
#include "BlockHandler.h"
+#include "Mixins.h"
#include "../Entities/Player.h"
#include "../UI/AnvilWindow.h"
@@ -10,11 +11,13 @@
class cBlockAnvilHandler :
- public cBlockHandler
+ public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
{
public:
+ using super = cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>;
+
cBlockAnvilHandler(BLOCKTYPE a_BlockType)
- : cBlockHandler(a_BlockType)
+ : super(a_BlockType)
{
}
@@ -45,21 +48,12 @@ public:
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override
{
- a_BlockType = m_BlockType;
- NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage);
- int Direction = static_cast<int>(floor(a_Player.GetYaw() * 4.0 / 360.0 + 1.5)) & 0x3;
-
- switch (Direction)
+ if (!super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta))
{
- case 0: a_BlockMeta = static_cast<NIBBLETYPE>(0x2 | Meta << 2); break;
- case 1: a_BlockMeta = static_cast<NIBBLETYPE>(0x3 | Meta << 2); break;
- case 2: a_BlockMeta = static_cast<NIBBLETYPE>(0x0 | Meta << 2); break;
- case 3: a_BlockMeta = static_cast<NIBBLETYPE>(0x1 | Meta << 2); break;
- default:
- {
- return false;
- }
+ return false;
}
+
+ a_BlockMeta = a_BlockMeta | static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage << 2);
return true;
}
diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h
index 2176bba96..cd70c95b6 100644
--- a/src/Blocks/BlockChest.h
+++ b/src/Blocks/BlockChest.h
@@ -11,9 +11,9 @@
class cBlockChestHandler :
- public cYawRotator<cContainerEntityHandler<cBlockEntityHandler>>
+ public cYawRotator<cContainerEntityHandler<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>
{
- using super = cYawRotator<cContainerEntityHandler<cBlockEntityHandler>>;
+ using super = cYawRotator<cContainerEntityHandler<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>;
public:
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 61185f562..be589ed29 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -12,9 +12,9 @@
class cBlockDoorHandler :
- public cYawRotator<cBlockHandler, 0x03, 0x01, 0x02, 0x03, 0x00, true>
+ public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
{
- using super = cYawRotator<cBlockHandler, 0x03, 0x01, 0x02, 0x03, 0x00, true>;
+ using super = cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>;
public:
diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h
index df29ca14a..2cade1210 100644
--- a/src/Blocks/BlockDropSpenser.h
+++ b/src/Blocks/BlockDropSpenser.h
@@ -14,9 +14,9 @@
class cBlockDropSpenserHandler :
- public cPitchYawRotator<cBlockEntityHandler>
+ public cPitchYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>
{
- using super = cPitchYawRotator<cBlockEntityHandler>;
+ using super = cPitchYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>;
public:
diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h
index 10606242b..c4044a0b2 100644
--- a/src/Blocks/BlockFurnace.h
+++ b/src/Blocks/BlockFurnace.h
@@ -9,9 +9,9 @@
class cBlockFurnaceHandler :
- public cYawRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>
+ public cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>
{
- using super = cYawRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>;
+ using super = cYawRotator<cBlockEntityHandler, 0x07, 0x03, 0x04, 0x02, 0x05>;
public:
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index 0ced74626..53a3537a2 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -17,9 +17,9 @@ class cWorld;
class cBlockPistonHandler:
- public cClearMetaOnDrop<cPitchYawRotator<cBlockHandler>>
+ public cClearMetaOnDrop<cPitchYawRotator<cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>>
{
- using super = cClearMetaOnDrop<cPitchYawRotator<cBlockHandler>>;
+ using super = cClearMetaOnDrop<cPitchYawRotator<cBlockHandler, 0x07, 0x03, 0x04, 0x02, 0x05, 0x01, 0x00>>;
public:
diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h
index ac1c77ecc..150d305e1 100644
--- a/src/Blocks/BlockPumpkin.h
+++ b/src/Blocks/BlockPumpkin.h
@@ -6,9 +6,9 @@
class cBlockPumpkinHandler :
- public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01>>
+ public cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>
{
- using super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01>>;
+ using super = cClearMetaOnDrop<cYawRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03>>;
public:
cBlockPumpkinHandler(BLOCKTYPE a_BlockType) :
diff --git a/src/Blocks/Mixins.h b/src/Blocks/Mixins.h
index 62eaeae5c..1ee2876d3 100644
--- a/src/Blocks/Mixins.h
+++ b/src/Blocks/Mixins.h
@@ -203,7 +203,10 @@ public:
) override
{
NIBBLETYPE BaseMeta;
- super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, BaseMeta);
+ if (!super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, BaseMeta))
+ {
+ return false;
+ }
a_BlockMeta = (BaseMeta & ~BitMask) | YawToMetaData(a_Player.GetYaw());
return true;
@@ -249,8 +252,8 @@ template <
NIBBLETYPE East = 0x05,
NIBBLETYPE South = 0x03,
NIBBLETYPE West = 0x04,
- NIBBLETYPE Up = 0x01,
- NIBBLETYPE Down = 0x00
+ NIBBLETYPE Up = 0x00,
+ NIBBLETYPE Down = 0x01
>
class cPitchYawRotator:
public cYawRotator<Base, BitMask, North, East, South, West>
@@ -274,7 +277,10 @@ public:
) override
{
NIBBLETYPE BaseMeta;
- super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, BaseMeta);
+ if (!super::GetPlacementBlockTypeMeta(a_ChunkInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, BaseMeta))
+ {
+ return false;
+ }
a_BlockMeta = (BaseMeta & ~BitMask) | PitchYawToMetaData(a_Player.GetYaw(), a_Player.GetPitch());
return true;