summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockPiston.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-09 16:20:12 +0200
committermadmaxoft <github@xoft.cz>2013-08-10 08:22:53 +0200
commitd3c29c5a885a323dc0af5ccbee6af72a9b6de022 (patch)
tree32946af8cf1abc6a7466fca9e9d0d8e44226b459 /source/Blocks/BlockPiston.cpp
parentFixed squid crashing the server when above or below the world (diff)
downloadcuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar.gz
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar.bz2
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar.lz
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar.xz
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.tar.zst
cuberite-d3c29c5a885a323dc0af5ccbee6af72a9b6de022.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockPiston.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/Blocks/BlockPiston.cpp b/source/Blocks/BlockPiston.cpp
index d0f90559e..1bfac3ca1 100644
--- a/source/Blocks/BlockPiston.cpp
+++ b/source/Blocks/BlockPiston.cpp
@@ -35,7 +35,7 @@ cBlockPistonHandler::cBlockPistonHandler(BLOCKTYPE a_BlockType)
void cBlockPistonHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- char OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
int newX = a_BlockX;
int newY = a_BlockY;
@@ -67,3 +67,36 @@ bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cBlockPistonHeadHandler:
+
+cBlockPistonHeadHandler::cBlockPistonHeadHandler(void) :
+ super(E_BLOCK_PISTON_EXTENSION)
+{
+}
+
+
+
+
+
+void cBlockPistonHeadHandler::OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+
+ int newX = a_BlockX;
+ int newY = a_BlockY;
+ int newZ = a_BlockZ;
+ AddPistonDir(newX, newY, newZ, OldMeta & ~(8), -1);
+
+ BLOCKTYPE Block = a_World->GetBlock(newX, newY, newZ);
+ if ((Block == E_BLOCK_STICKY_PISTON) || (Block == E_BLOCK_PISTON))
+ {
+ a_World->DigBlock(newX, newY, newZ);
+ }
+}
+
+
+
+
+