From 7aca41a530580f0f5f4d94bf27e26a0b1478ddd1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 May 2020 20:33:25 +0100 Subject: [PATCH] Living: do not loop downwards searching for collision block, closes #3517 --- src/entity/Living.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/entity/Living.php b/src/entity/Living.php index 96922f200..febc3f1c2 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -262,14 +262,13 @@ abstract class Living extends Entity{ }else{ $fallBlockPos = $this->location->floor(); $fallBlock = $this->getWorld()->getBlock($fallBlockPos); - for( - ; - $fallBlock->getId() === BlockLegacyIds::AIR; - $fallBlockPos = $fallBlockPos->subtract(0, 1, 0), $fallBlock = $this->getWorld()->getBlock($fallBlockPos) - ){ - //this allows the correct sound to be played when landing in snow + if($fallBlock->getId() === BlockLegacyIds::AIR){ + $fallBlockPos = $fallBlockPos->subtract(0, 1, 0); + $fallBlock = $this->getWorld()->getBlock($fallBlockPos); + } + if($fallBlock->getId() !== BlockLegacyIds::AIR){ + $this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock)); } - $this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock)); } }