summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-25 17:15:19 +0100
committerMattes D <github@xoft.cz>2014-12-25 20:41:12 +0100
commiteddbce64be8af048581afb0db85a27dd50af26a6 (patch)
tree5178d8de97515c032667c55eb69333d61965aa34
parentMerge pull request #1687 from mc-server/StyleCheckTravis (diff)
downloadcuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar.gz
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar.bz2
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar.lz
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar.xz
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.tar.zst
cuberite-eddbce64be8af048581afb0db85a27dd50af26a6.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemMobHead.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index d962dabae..ac905275a 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -53,7 +53,7 @@ public:
)
{
// Place the block:
- if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_HEAD, static_cast<NIBBLETYPE>(a_EquippedItem.m_ItemType)))
+ if (!a_Player.PlaceBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_HEAD, BlockFaceToBlockMeta(a_BlockFace)))
{
return false;
}
@@ -92,7 +92,7 @@ public:
m_BlockMeta(a_BlockMeta)
{}
};
- cCallback Callback(a_Player, static_cast<eMobHeadType>(a_EquippedItem.m_ItemType), static_cast<NIBBLETYPE>(a_BlockFace));
+ cCallback Callback(a_Player, static_cast<eMobHeadType>(a_EquippedItem.m_ItemDamage), static_cast<NIBBLETYPE>(a_BlockFace));
a_World.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
return true;
}
@@ -279,6 +279,26 @@ public:
}
+ /** Converts the block face of the placement (which face of the block was clicked to place the head)
+ into the block's metadata value. */
+ static NIBBLETYPE BlockFaceToBlockMeta(int a_BlockFace)
+ {
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_TOP: return 0x01; // On ground (rotation provided in block entity)
+ case BLOCK_FACE_XM: return 0x04; // west wall, facing east
+ case BLOCK_FACE_XP: return 0x05; // east wall, facing west
+ case BLOCK_FACE_ZM: return 0x02; // north wall, facing south
+ case BLOCK_FACE_ZP: return 0x03; // south wall, facing north
+ default:
+ {
+ ASSERT(!"Unhandled block face");
+ return 0;
+ }
+ }
+ }
+
+
virtual bool IsPlaceable(void) override
{
return true;