summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
authorAltenius <jacobjm18@gmail.com>2016-07-06 01:21:53 +0200
committerAltenius <jacobjm18@gmail.com>2016-07-06 14:04:58 +0200
commitc54f9cede236b16bb54bd5fb3b82c62791b0d2c7 (patch)
treee782d2c1fbe004e6ee5a543bb803816d7c6aca76 /src/Blocks
parentMerge pull request #3250 from Altenius/master (diff)
downloadcuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar.gz
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar.bz2
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar.lz
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar.xz
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.tar.zst
cuberite-c54f9cede236b16bb54bd5fb3b82c62791b0d2c7.zip
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockPiston.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp
index 1da2a61ec..3bed01cc1 100644
--- a/src/Blocks/BlockPiston.cpp
+++ b/src/Blocks/BlockPiston.cpp
@@ -32,13 +32,17 @@ void cBlockPistonHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorld
{
Vector3i blockPos(a_BlockX, a_BlockY, a_BlockZ);
- // Get the extension of the piston
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(blockPos.x, blockPos.y, blockPos.z);
- blockPos += MetadataToOffset(OldMeta);
-
- if (a_ChunkInterface.GetBlock(blockPos) == E_BLOCK_PISTON_EXTENSION)
+ // If the piston is extended, destroy the extension as well
+ if (IsExtended(OldMeta))
{
- a_ChunkInterface.SetBlock(blockPos.x, blockPos.y, blockPos.z, E_BLOCK_AIR, 0);
+ // Get the position of the extension
+ blockPos += MetadataToOffset(OldMeta);
+
+ if (a_ChunkInterface.GetBlock(blockPos) == E_BLOCK_PISTON_EXTENSION)
+ {
+ a_ChunkInterface.SetBlock(blockPos.x, blockPos.y, blockPos.z, E_BLOCK_AIR, 0);
+ }
}
}