summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockPiston.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-15 03:28:18 +0100
committerGitHub <noreply@github.com>2021-03-15 03:28:18 +0100
commit45591cbe7bef4c54c241a286ece07bc4ade4489e (patch)
treea6b2b8a7e8c2d2986612e70cd904f5446b82e2d6 /src/Blocks/BlockPiston.cpp
parentFixed some death messages showing up even when they are disabled. (#5153) (diff)
downloadcuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.gz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.bz2
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.lz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.xz
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.tar.zst
cuberite-45591cbe7bef4c54c241a286ece07bc4ade4489e.zip
Diffstat (limited to 'src/Blocks/BlockPiston.cpp')
-rw-r--r--src/Blocks/BlockPiston.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp
index 20863cdf3..ee8620308 100644
--- a/src/Blocks/BlockPiston.cpp
+++ b/src/Blocks/BlockPiston.cpp
@@ -48,7 +48,7 @@ void cBlockPistonHandler::ExtendPiston(Vector3i a_BlockPos, cWorld & a_World)
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
- a_World.GetBlockTypeMeta(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, pistonBlock, pistonMeta);
+ a_World.GetBlockTypeMeta(a_BlockPos, pistonBlock, pistonMeta);
a_World.BroadcastBlockAction(a_BlockPos, PistonExtendAction, pistonMeta, pistonBlock);
}
@@ -60,7 +60,7 @@ void cBlockPistonHandler::ExtendPiston(Vector3i a_BlockPos, cWorld & a_World)
{
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
- World.GetBlockTypeMeta(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, pistonBlock, pistonMeta);
+ World.GetBlockTypeMeta(a_BlockPos, pistonBlock, pistonMeta);
if ((pistonBlock != E_BLOCK_PISTON) && !IsSticky(pistonBlock))
{
@@ -86,11 +86,8 @@ void cBlockPistonHandler::ExtendPiston(Vector3i a_BlockPos, cWorld & a_World)
// Set the extension and the piston base correctly
Vector3i extensionPos = a_BlockPos + pushDir;
- World.SetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, pistonBlock, pistonMeta | 0x8);
- World.SetBlock(
- extensionPos.x, extensionPos.y, extensionPos.z,
- E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0)
- );
+ World.SetBlock(a_BlockPos, pistonBlock, pistonMeta | 0x8);
+ World.SetBlock(extensionPos, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0));
// Play sound effect only if extended successfully
World.BroadcastSoundEffect("block.piston.extend", a_BlockPos, 0.5f, 0.7f);
@@ -107,7 +104,7 @@ void cBlockPistonHandler::RetractPiston(Vector3i a_BlockPos, cWorld & a_World)
{
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
- a_World.GetBlockTypeMeta(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, pistonBlock, pistonMeta);
+ a_World.GetBlockTypeMeta(a_BlockPos, pistonBlock, pistonMeta);
a_World.BroadcastBlockAction(a_BlockPos, PistonRetractAction, pistonMeta, pistonBlock);
}
@@ -115,7 +112,7 @@ void cBlockPistonHandler::RetractPiston(Vector3i a_BlockPos, cWorld & a_World)
{
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
- World.GetBlockTypeMeta(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, pistonBlock, pistonMeta);
+ World.GetBlockTypeMeta(a_BlockPos, pistonBlock, pistonMeta);
if ((pistonBlock != E_BLOCK_PISTON) && !IsSticky(pistonBlock))
{
@@ -192,7 +189,7 @@ void cBlockPistonHandler::PushBlocks(
NIBBLETYPE moveMeta;
for (auto & moveBlockPos : sortedBlocks)
{
- a_World.GetBlockTypeMeta(moveBlockPos.x, moveBlockPos.y, moveBlockPos.z, moveBlock, moveMeta);
+ a_World.GetBlockTypeMeta(moveBlockPos, moveBlock, moveMeta);
if (cBlockInfo::IsPistonBreakable(moveBlock))
{
@@ -202,9 +199,9 @@ void cBlockPistonHandler::PushBlocks(
else
{
// Not breakable, just move it
- a_World.SetBlock(moveBlockPos.x, moveBlockPos.y, moveBlockPos.z, E_BLOCK_AIR, 0);
+ a_World.SetBlock(moveBlockPos, E_BLOCK_AIR, 0);
moveBlockPos += a_PushDir;
- a_World.SetBlock(moveBlockPos.x, moveBlockPos.y, moveBlockPos.z, moveBlock, moveMeta);
+ a_World.SetBlock(moveBlockPos, moveBlock, moveMeta);
}
}
}
@@ -229,7 +226,7 @@ bool cBlockPistonHandler::CanPushBlock(
BLOCKTYPE currBlock;
NIBBLETYPE currMeta;
- a_World.GetBlockTypeMeta(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, currBlock, currMeta);
+ a_World.GetBlockTypeMeta(a_BlockPos, currBlock, currMeta);
if (!cChunkDef::IsValidHeight(a_BlockPos.y))
{