mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
tried porting structure api from 1.5.2
This commit is contained in:
parent
4715d938e1
commit
fad3a556dd
15 changed files with 649 additions and 27 deletions
|
|
@ -60,7 +60,7 @@ class AxisAlignedBB{
|
|||
public function grow($x, $y, $z){
|
||||
return new AxisAlignedBB($this->minX - $x, $this->minY - $y, $this->minZ - $z, $this->maxX + $x, $this->maxY + $y, $this->maxZ + $z);
|
||||
}
|
||||
|
||||
|
||||
public function expand($x, $y, $z){
|
||||
$this->minX -= $x;
|
||||
$this->minY -= $y;
|
||||
|
|
@ -71,7 +71,8 @@ class AxisAlignedBB{
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function offset($x, $y, $z){
|
||||
$this->minX += $x;
|
||||
$this->minY += $y;
|
||||
|
|
@ -305,6 +306,28 @@ class AxisAlignedBB{
|
|||
return MovingObjectPosition::fromBlock(0, 0, 0, $f, $vector);
|
||||
}
|
||||
|
||||
public function expandTo(AxisAlignedBB $bb){
|
||||
$this->minX = min($this->minX, $bb->minX);
|
||||
$this->minY = min($this->minY, $bb->minY);
|
||||
$this->minZ = min($this->minZ, $bb->minZ);
|
||||
$this->maxX = max($this->maxX, $bb->maxX);
|
||||
$this->maxY = max($this->maxY, $bb->maxY);
|
||||
$this->maxZ = max($this->maxZ, $bb->maxZ);
|
||||
}
|
||||
|
||||
public function getXSize(){
|
||||
return $this->maxX - $this->minX + 1;
|
||||
}
|
||||
|
||||
public function getYSize(){
|
||||
return $this->maxY - $this->minY + 1;
|
||||
}
|
||||
|
||||
public function getZSize(){
|
||||
return $this->maxZ - $this->minZ + 1;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(){
|
||||
return "min: {$this->minX}, {$this->minY}, {$this->minZ}, max: {$this->maxX}, {$this->maxY}, {$this->maxZ}";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue