summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockBigFlower.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2022-02-08 18:37:11 +0100
committerAlexander Harkness <me@bearbin.net>2022-02-09 09:45:25 +0100
commitf98ceebea1e20e5acfa2ed32ffb5629b427a2712 (patch)
tree96a8203caaea91fc39af662a2cba1b8c96ea055b /src/Blocks/BlockBigFlower.h
parentCorrect Indentation IF (diff)
downloadcuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar.gz
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar.bz2
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar.lz
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar.xz
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.tar.zst
cuberite-f98ceebea1e20e5acfa2ed32ffb5629b427a2712.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockBigFlower.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h
index 4acebaa38..efbe54f6a 100644
--- a/src/Blocks/BlockBigFlower.h
+++ b/src/Blocks/BlockBigFlower.h
@@ -118,30 +118,29 @@ private:
const cEntity * a_Digger
) const override
{
- UNUSED(a_Digger);
- if ((a_OldBlockMeta & 0x8) != 0)
+ if (IsMetaTopPart(a_OldBlockMeta))
{
- // Was upper part of flower
- auto lowerPartPos = a_BlockPos - Vector3i(0, 1, 0);
- if (a_ChunkInterface.GetBlock(lowerPartPos) == a_OldBlockType)
+ const auto LowerPart = a_BlockPos.addedY(-1);
+ if (a_ChunkInterface.GetBlock(LowerPart) == a_OldBlockType)
{
- if (a_Digger->IsPlayer() && (static_cast<const cPlayer *>(a_Digger))->IsGameModeCreative())
+ // Prevent creative punches from dropping pickups.
+ // TODO: Simplify to SetBlock and remove the IsMetaTopPart check in DropBlockAsPickups when 1.13 blockstates arrive.
+ if (a_Digger->IsPlayer() && static_cast<const cPlayer *>(a_Digger)->IsGameModeCreative())
{
- a_ChunkInterface.SetBlock(lowerPartPos, E_BLOCK_AIR, 0);
+ a_ChunkInterface.SetBlock(LowerPart, E_BLOCK_AIR, 0);
}
else
{
- a_ChunkInterface.DropBlockAsPickups(lowerPartPos);
+ a_ChunkInterface.DropBlockAsPickups(LowerPart);
}
}
}
else
{
- // Was lower part
- auto upperPartPos = a_BlockPos + Vector3i(0, 1, 0);
- if (a_ChunkInterface.GetBlock(upperPartPos) == a_OldBlockType)
+ const auto UpperPart = a_BlockPos.addedY(1);
+ if (a_ChunkInterface.GetBlock(UpperPart) == a_OldBlockType)
{
- a_ChunkInterface.SetBlock(upperPartPos, E_BLOCK_AIR, 0);
+ a_ChunkInterface.SetBlock(UpperPart, E_BLOCK_AIR, 0);
}
}
}