Fix chorus not working if the destination would be below y=0 (#5979)

This commit is contained in:
Hugo_ 2023-08-10 10:42:58 +02:00 committed by GitHub
parent b86b389fc5
commit f03e708f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}