summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-11-28 21:48:53 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2020-11-28 21:48:53 +0100
commit815f2aed821d9c6b7fb5355764d8d04f0bd5f28c (patch)
tree07cc5675cb7517e539c82f8d07c4cb441283ea6e
parentFix lilypad displacing block above (#5056) (diff)
downloadcuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar.gz
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar.bz2
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar.lz
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar.xz
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.tar.zst
cuberite-815f2aed821d9c6b7fb5355764d8d04f0bd5f28c.zip
-rw-r--r--src/Items/ItemLilypad.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h
index 5760ff830..b448b33c8 100644
--- a/src/Items/ItemLilypad.h
+++ b/src/Items/ItemLilypad.h
@@ -63,9 +63,15 @@ public:
return false;
}
- // Lilypad should be placed only if there is a water block below
+ const auto Below = PlacePos.addedY(-1);
+ if (Below.y < 0)
+ {
+ return false;
+ }
+
+ // Lilypad should be placed only if there is a water block below:
if (
- const auto BlockBelow = a_World->GetBlock(PlacePos.addedY(-1));
+ const auto BlockBelow = a_World->GetBlock(Below);
(BlockBelow != E_BLOCK_WATER) &&
(BlockBelow != E_BLOCK_STATIONARY_WATER)
)
@@ -78,6 +84,7 @@ public:
{
a_Player->GetInventory().RemoveOneEquippedItem();
}
+
return true;
}