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,16 +262,15 @@ 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)
){
//this allows the correct sound to be played when landing in snow
} }
if($fallBlock->getId() !== BlockLegacyIds::AIR){
$this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock)); $this->getWorld()->addSound($this->location, new EntityLandSound($this, $fallBlock));
} }
} }
}
/** /**
* Returns how many armour points this mob has. Armour points provide a percentage reduction to damage. * Returns how many armour points this mob has. Armour points provide a percentage reduction to damage.