From f03e708f64ce8cc2d2dc7f379b127d4d990c6a5f Mon Sep 17 00:00:00 2001 From: Hugo_ <55756021+Dhaiven@users.noreply.github.com> Date: Thu, 10 Aug 2023 10:42:58 +0200 Subject: [PATCH] Fix chorus not working if the destination would be below y=0 (#5979) --- src/item/ChorusFruit.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/item/ChorusFruit.php b/src/item/ChorusFruit.php index 80f99d5d8..c12724d7c 100644 --- a/src/item/ChorusFruit.php +++ b/src/item/ChorusFruit.php @@ -56,15 +56,17 @@ class ChorusFruit extends Food{ $maxY = $minY + 16; $maxZ = $minZ + 16; + $worldMinY = $world->getMinY(); + for($attempts = 0; $attempts < 16; ++$attempts){ $x = mt_rand($minX, $maxX); $y = mt_rand($minY, $maxY); $z = mt_rand($minZ, $maxZ); - while($y >= 0 && !$world->getBlockAt($x, $y, $z)->isSolid()){ + while($y >= $worldMinY && !$world->getBlockAt($x, $y, $z)->isSolid()){ $y--; } - if($y < 0){ + if($y < $worldMinY){ continue; }