mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Improved Vector3 and Block handling, less allocation on Positions
This commit is contained in:
@@ -40,7 +40,7 @@ use pocketmine\level\Location;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Math;
|
||||
use pocketmine\math\Vector3 as Vector3;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\metadata\Metadatable;
|
||||
use pocketmine\metadata\MetadataValue;
|
||||
use pocketmine\nbt\tag\Byte;
|
||||
@@ -737,7 +737,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
|
||||
public function getPosition(){
|
||||
return new Position($this->x, $this->y, $this->z, $this->level);
|
||||
return Position::createPosition($this->x, $this->y, $this->z, $this->level);
|
||||
}
|
||||
|
||||
public function getLocation(){
|
||||
|
@@ -88,7 +88,7 @@ class FallingBlock extends Entity{
|
||||
|
||||
if(!$this->dead){
|
||||
if($this->ticksLived === 1){
|
||||
$block = $this->level->getBlock($pos = Vector3::createVector($this->x, $this->y, $this->z)->floor());
|
||||
$block = $this->level->getBlock($pos = Vector3::cloneVector($this)->floor());
|
||||
if($block->getID() != $this->blockId){
|
||||
$this->kill();
|
||||
return true;
|
||||
@@ -107,7 +107,7 @@ class FallingBlock extends Entity{
|
||||
$this->motionY *= 1 - $this->drag;
|
||||
$this->motionZ *= $friction;
|
||||
|
||||
$pos = Vector3::createVector($this->x, $this->y, $this->z)->floor();
|
||||
$pos = Vector3::cloneVector($this)->floor();
|
||||
|
||||
if($this->onGround){
|
||||
$this->kill();
|
||||
|
Reference in New Issue
Block a user