summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-02-28 17:16:21 +0100
committerMattes D <github@xoft.cz>2015-02-28 17:16:21 +0100
commit88fc70a06a9e2d15f9a672f792e0029a79be136f (patch)
tree7b212db91a2443b791a956fe69008657e1b9d2c9 /src
parentMerge pull request #1778 from mc-server/OreXP (diff)
downloadcuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar.gz
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar.bz2
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar.lz
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar.xz
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.tar.zst
cuberite-88fc70a06a9e2d15f9a672f792e0029a79be136f.zip
Diffstat (limited to 'src')
-rw-r--r--src/Items/ItemDoor.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Items/ItemDoor.h b/src/Items/ItemDoor.h
index 18289be03..71143d5a8 100644
--- a/src/Items/ItemDoor.h
+++ b/src/Items/ItemDoor.h
@@ -77,19 +77,32 @@ public:
NIBBLETYPE LowerBlockMeta = cBlockDoorHandler::PlayerYawToMetaData(a_Player.GetYaw());
Vector3i RelDirToOutside = cBlockDoorHandler::GetRelativeDirectionToOutside(LowerBlockMeta);
Vector3i LeftNeighborPos = RelDirToOutside;
- LeftNeighborPos.TurnCCW();
+ LeftNeighborPos.TurnCW();
LeftNeighborPos.Move(a_BlockX, a_BlockY, a_BlockZ);
Vector3i RightNeighborPos = RelDirToOutside;
- RightNeighborPos.TurnCW();
+ RightNeighborPos.TurnCCW();
RightNeighborPos.Move(a_BlockX, a_BlockY, a_BlockZ);
// Decide whether the hinge is on the left (default) or on the right:
NIBBLETYPE UpperBlockMeta = 0x08;
+ BLOCKTYPE LeftNeighborBlock = a_World.GetBlock(LeftNeighborPos);
+ BLOCKTYPE RightNeighborBlock = a_World.GetBlock(RightNeighborPos);
+ /*
+ // DEBUG:
+ LOGD("Door being placed at {%d, %d, %d}", a_BlockX, a_BlockY, a_BlockZ);
+ LOGD("RelDirToOutside: {%d, %d, %d}", RelDirToOutside.x, RelDirToOutside.y, RelDirToOutside.z);
+ LOGD("Left neighbor at {%d, %d, %d}: %d (%s)", LeftNeighborPos.x, LeftNeighborPos.y, LeftNeighborPos.z, LeftNeighborBlock, ItemTypeToString(LeftNeighborBlock).c_str());
+ LOGD("Right neighbor at {%d, %d, %d}: %d (%s)", RightNeighborPos.x, RightNeighborPos.y, RightNeighborPos.z, RightNeighborBlock, ItemTypeToString(RightNeighborBlock).c_str());
+ */
if (
- cBlockDoorHandler::IsDoorBlockType(a_World.GetBlock(LeftNeighborPos)) || // The block to the left is a door block
- cBlockInfo::IsSolid(a_World.GetBlock(RightNeighborPos)) // The block to the right is solid
+ cBlockDoorHandler::IsDoorBlockType(LeftNeighborBlock) || // The block to the left is a door block
+ (
+ cBlockInfo::IsSolid(RightNeighborBlock) && // The block to the right is solid...
+ !cBlockDoorHandler::IsDoorBlockType(RightNeighborBlock) // ... but not a door
+ )
)
{
+ // DEBUG: LOGD("Setting hinge to right side");
UpperBlockMeta = 0x09; // Upper block | hinge on right
}