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

@ -68,30 +68,30 @@ class EndRod extends Flowable{
switch($m){
case 0x00: //up/down
return new AxisAlignedBB(
$this->x + $width,
$this->y,
$this->z + $width,
$this->x + 1 - $width,
$this->y + 1,
$this->z + 1 - $width
$width,
0,
$width,
1 - $width,
1,
1 - $width
);
case 0x02: //north/south
return new AxisAlignedBB(
$this->x,
$this->y + $width,
$this->z + $width,
$this->x + 1,
$this->y + 1 - $width,
$this->z + 1 - $width
0,
$width,
$width,
1,
1 - $width,
1 - $width
);
case 0x04: //east/west
return new AxisAlignedBB(
$this->x + $width,
$this->y + $width,
$this->z,
$this->x + 1 - $width,
$this->y + 1 - $width,
$this->z + 1
$width,
$width,
0,
1 - $width,
1 - $width,
1
);
}