mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation
This commit is contained in:
@ -53,14 +53,11 @@ abstract class Door extends Transparent{
|
||||
}
|
||||
|
||||
public function getBoundingBox(){
|
||||
if($this->boundingBox !== null){
|
||||
return $this->boundingBox;
|
||||
}
|
||||
|
||||
$f = 0.1875;
|
||||
$damage = $this->getFullDamage();
|
||||
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -76,7 +73,7 @@ abstract class Door extends Transparent{
|
||||
if($j === 0){
|
||||
if($flag){
|
||||
if(!$flag1){
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -85,7 +82,7 @@ abstract class Door extends Transparent{
|
||||
$this->z + $f
|
||||
);
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z + 1 - $f,
|
||||
@ -95,7 +92,7 @@ abstract class Door extends Transparent{
|
||||
);
|
||||
}
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -107,7 +104,7 @@ abstract class Door extends Transparent{
|
||||
}elseif($j === 1){
|
||||
if($flag){
|
||||
if(!$flag1){
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x + 1 - $f,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -116,7 +113,7 @@ abstract class Door extends Transparent{
|
||||
$this->z + 1
|
||||
);
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -126,7 +123,7 @@ abstract class Door extends Transparent{
|
||||
);
|
||||
}
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -138,7 +135,7 @@ abstract class Door extends Transparent{
|
||||
}elseif($j === 2){
|
||||
if($flag){
|
||||
if(!$flag1){
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z + 1 - $f,
|
||||
@ -147,7 +144,7 @@ abstract class Door extends Transparent{
|
||||
$this->z + 1
|
||||
);
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -157,7 +154,7 @@ abstract class Door extends Transparent{
|
||||
);
|
||||
}
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x + 1 - $f,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -169,7 +166,7 @@ abstract class Door extends Transparent{
|
||||
}elseif($j === 3){
|
||||
if($flag){
|
||||
if(!$flag1){
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -178,7 +175,7 @@ abstract class Door extends Transparent{
|
||||
$this->z + 1
|
||||
);
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x + 1 - $f,
|
||||
$this->y,
|
||||
$this->z,
|
||||
@ -188,7 +185,7 @@ abstract class Door extends Transparent{
|
||||
);
|
||||
}
|
||||
}else{
|
||||
$bb = new AxisAlignedBB(
|
||||
$bb = AxisAlignedBB::getBoundingBoxFromPool(
|
||||
$this->x,
|
||||
$this->y,
|
||||
$this->z + 1 - $f,
|
||||
@ -199,7 +196,7 @@ abstract class Door extends Transparent{
|
||||
}
|
||||
}
|
||||
|
||||
return $this->boundingBox = $bb;
|
||||
return $bb;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
|
Reference in New Issue
Block a user