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

@ -50,15 +50,7 @@ class Carpet extends Flowable{
}
protected function recalculateBoundingBox() : ?AxisAlignedBB{
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.0625,
$this->z + 1
);
return new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{