Entity: replace separate height/width/eyeHeight fields with an EntitySizeInfo structure

this will make it easier to implement stuff like sleeping (properly), swimming and gliding without needing to duplicate all the fields.
This commit is contained in:
Dylan K. Taylor
2021-01-08 00:10:11 +00:00
parent 574b615b4c
commit e53b57732b
15 changed files with 103 additions and 60 deletions

View File

@ -715,7 +715,7 @@ abstract class Living extends Entity{
$blocks = [];
$nextIndex = 0;
foreach(VoxelRayTrace::inDirection($this->location->add(0, $this->eyeHeight, 0), $this->getDirectionVector(), $maxDistance) as $vector3){
foreach(VoxelRayTrace::inDirection($this->location->add(0, $this->size->getEyeHeight(), 0), $this->getDirectionVector(), $maxDistance) as $vector3){
$block = $this->getWorld()->getBlockAt($vector3->x, $vector3->y, $vector3->z);
$blocks[$nextIndex++] = $block;