summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockDoor.cpp
diff options
context:
space:
mode:
authorluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-19 10:29:53 +0100
committerluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-19 10:29:53 +0100
commita10c4774f541028817c2a08dc6860fef252d0200 (patch)
tree4db3805965552fccc43d14febb9e83148a0a3f5b /source/Blocks/BlockDoor.cpp
parentFixed time calculation in cWorld::Tick() (diff)
downloadcuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar.gz
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar.bz2
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar.lz
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar.xz
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.tar.zst
cuberite-a10c4774f541028817c2a08dc6860fef252d0200.zip
Diffstat (limited to 'source/Blocks/BlockDoor.cpp')
-rw-r--r--source/Blocks/BlockDoor.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/source/Blocks/BlockDoor.cpp b/source/Blocks/BlockDoor.cpp
index c0d616b37..1976e2f20 100644
--- a/source/Blocks/BlockDoor.cpp
+++ b/source/Blocks/BlockDoor.cpp
@@ -54,15 +54,6 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY
-void cBlockDoorHandler::OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
-{
- cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
-}
-
-
-
-
-
void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
@@ -77,7 +68,24 @@ void cBlockDoorHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLET
if (a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ) == E_BLOCK_AIR)
{
a_BlockMeta = cDoors::RotationToMetaData(a_Player->GetRotation());
- a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_BlockMeta + 8);
+ char a_TopBlockMeta = 8;
+ if((a_BlockMeta == 0) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType))
+ {
+ a_TopBlockMeta = 9;
+ }
+ else if((a_BlockMeta == 1) && (a_World->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType))
+ {
+ a_TopBlockMeta = 9;
+ }
+ else if((a_BlockMeta == 2) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType))
+ {
+ a_TopBlockMeta = 9;
+ }
+ else if((a_BlockMeta == 3) && (a_World->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
+ {
+ a_TopBlockMeta = 9;
+ }
+ a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, a_BlockMeta);
OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}