Living: Trigger fall sounds on the nearest collidable block below

we can't have landed on it unless it actually has a collision box - otherwise, we only landed _in_ it.
This assumes, of course, that no blocks have bounding boxes >= 2 blocks tall, which currently none do.
This commit is contained in:
Dylan K. Taylor 2021-09-05 14:10:54 +01:00
parent d329bfb25d
commit 17dfd2cc52
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -318,7 +318,7 @@ abstract class Living extends Entity{
}else{
$fallBlockPos = $this->location->floor();
$fallBlock = $this->getWorld()->getBlock($fallBlockPos);
if($fallBlock->getId() === BlockLegacyIds::AIR){
if(count($fallBlock->getCollisionBoxes()) === 0){
$fallBlockPos = $fallBlockPos->subtract(0, 1, 0);
$fallBlock = $this->getWorld()->getBlock($fallBlockPos);
}