Living: do not loop downwards searching for collision block, closes #3517

This commit is contained in:
Dylan K. Taylor 2020-05-20 20:33:25 +01:00
parent 64bb126bf5
commit 7aca41a530

View File

@ -262,14 +262,13 @@ abstract class Living extends Entity{
}else{ }else{
$fallBlockPos = $this->location->floor(); $fallBlockPos = $this->location->floor();
$fallBlock = $this->getWorld()->getBlock($fallBlockPos); $fallBlock = $this->getWorld()->getBlock($fallBlockPos);
for( if($fallBlock->getId() === BlockLegacyIds::AIR){
; $fallBlockPos = $fallBlockPos->subtract(0, 1, 0);
$fallBlock->getId() === BlockLegacyIds::AIR; $fallBlock = $this->getWorld()->getBlock($fallBlockPos);
$fallBlockPos = $fallBlockPos->subtract(0, 1, 0), $fallBlock = $this->getWorld()->getBlock($fallBlockPos) }
){ if($fallBlock->getId() !== BlockLegacyIds::AIR){
//this allows the correct sound to be played when landing in snow $this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock));
} }
$this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock));
} }
} }