Entity: Fixed logic error in getBlocksAround() which caused yet another firebug

Try setting a fire at z = -204, then stand on the edge between -205 and -206.

The coordinates that a BB's corners are encapsulated in are always the floor()ed coordinates

If you stand at -205.0, your BB min is -205.3 and your BB max is -204.7, which then incorrectly tells you that the BB intersects with block -204
because ceil(-204.7) == -204
when you actually are only intersecting with -205 and -206
this is as bad as using (int) to floor integers :kms:
This commit is contained in:
Dylan K. Taylor 2018-01-21 15:43:03 +00:00
parent a4f5cab12d
commit 65fe19ca71

View File

@ -1665,9 +1665,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$minX = Math::floorFloat($this->boundingBox->minX + $inset);
$minY = Math::floorFloat($this->boundingBox->minY + $inset);
$minZ = Math::floorFloat($this->boundingBox->minZ + $inset);
$maxX = Math::ceilFloat($this->boundingBox->maxX - $inset);
$maxY = Math::ceilFloat($this->boundingBox->maxY - $inset);
$maxZ = Math::ceilFloat($this->boundingBox->maxZ - $inset);
$maxX = Math::floorFloat($this->boundingBox->maxX - $inset);
$maxY = Math::floorFloat($this->boundingBox->maxY - $inset);
$maxZ = Math::floorFloat($this->boundingBox->maxZ - $inset);
$this->blocksAround = [];