Block: Make recalculation of BB non-dependent on block position

This now computes BBs relative to 0,0,0 and then offsets them as appropriate. This requires less boilerplate code and also furthers the goal of separating block types from instances.
This commit is contained in:
Dylan K. Taylor
2018-06-21 19:58:28 +01:00
parent 56b04fa0bb
commit 99a0c2a188
25 changed files with 149 additions and 407 deletions

View File

@ -45,14 +45,7 @@ class GrassPath extends Transparent{
}
protected function recalculateBoundingBox() : ?AxisAlignedBB{
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1, //TODO: this should be 0.9375, but MCPE currently treats them as a full block (https://bugs.mojang.com/browse/MCPE-12109)
$this->z + 1
);
return new AxisAlignedBB(0, 0, 0, 1, 1, 1); //TODO: y max should be 0.9375, but MCPE currently treats them as a full block (https://bugs.mojang.com/browse/MCPE-12109)
}
public function getHardness() : float{