diff --git a/composer.json b/composer.json index 011adf8f0..966fddeeb 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "pocketmine/spl": "0.3.0", "pocketmine/binaryutils": "dev-master#c824ac67eeeb6899c2a9ec91a769eb9ed6e3f595", "pocketmine/nbt": "dev-master#09809564c7e58c322dcefc6905ab333313e05d1f", - "pocketmine/math": "dev-master#f88790f343b72563bf69658d6f14630fba580905", + "pocketmine/math": "dev-master#95ae5600328ed2add44c0bc830a68d3660e9e0ef", "pocketmine/snooze": "dev-master#541f0f038f401e9117ae60c8dbc167a46569282d" }, "autoload": { diff --git a/composer.lock b/composer.lock index ebccbec7e..4cb1f207f 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9993493665deb27b5b984de2c596cdc5", + "content-hash": "43d1b7cd0a341ec946218a7664720fd0", "packages": [ { "name": "pocketmine/binaryutils", @@ -46,12 +46,12 @@ "source": { "type": "git", "url": "https://github.com/pmmp/Math.git", - "reference": "f88790f343b72563bf69658d6f14630fba580905" + "reference": "95ae5600328ed2add44c0bc830a68d3660e9e0ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/Math/zipball/f88790f343b72563bf69658d6f14630fba580905", - "reference": "f88790f343b72563bf69658d6f14630fba580905", + "url": "https://api.github.com/repos/pmmp/Math/zipball/95ae5600328ed2add44c0bc830a68d3660e9e0ef", + "reference": "95ae5600328ed2add44c0bc830a68d3660e9e0ef", "shasum": "" }, "require": { @@ -72,7 +72,7 @@ "source": "https://github.com/pmmp/Math/tree/master", "issues": "https://github.com/pmmp/Math/issues" }, - "time": "2018-05-28T12:55:13+00:00" + "time": "2018-06-09T09:26:30+00:00" }, { "name": "pocketmine/nbt", diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 04e010b42..920ded9ac 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1503,7 +1503,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } protected function checkNearEntities(int $tickDiff){ - foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 0.5, 1), $this) as $entity){ + foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(1, 0.5, 1), $this) as $entity){ $entity->scheduleUpdate(); if(!$entity->isAlive() or $entity->isFlaggedForDespawn()){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 442f7ae0e..478fcecce 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1478,7 +1478,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ Timings::$entityMoveTimer->startTiming(); - $newBB = $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz); + $newBB = $this->boundingBox->offsetCopy($dx, $dy, $dz); $list = $this->level->getCollisionCubes($this, $newBB, false); @@ -1566,7 +1566,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ assert(abs($dx) <= 20 and abs($dy) <= 20 and abs($dz) <= 20, "Movement distance is excessive: dx=$dx, dy=$dy, dz=$dz"); - $list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false); + $list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->offsetCopy($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false); foreach($list as $bb){ $dy = $bb->calculateYOffset($this->boundingBox, $dy); diff --git a/src/pocketmine/entity/projectile/Projectile.php b/src/pocketmine/entity/projectile/Projectile.php index 023a504f1..e88e0cc6d 100644 --- a/src/pocketmine/entity/projectile/Projectile.php +++ b/src/pocketmine/entity/projectile/Projectile.php @@ -185,7 +185,7 @@ abstract class Projectile extends Entity{ continue; } - $entityBB = $entity->boundingBox->grow(0.3, 0.3, 0.3); + $entityBB = $entity->boundingBox->expandedCopy(0.3, 0.3, 0.3); $entityHitResult = $entityBB->calculateIntercept($start, $end); if($entityHitResult === null){ diff --git a/src/pocketmine/entity/projectile/SplashPotion.php b/src/pocketmine/entity/projectile/SplashPotion.php index 434f854ca..4720a5c28 100644 --- a/src/pocketmine/entity/projectile/SplashPotion.php +++ b/src/pocketmine/entity/projectile/SplashPotion.php @@ -81,7 +81,7 @@ class SplashPotion extends Throwable{ if($hasEffects){ if(!$this->willLinger()){ - foreach($this->level->getNearbyEntities($this->boundingBox->grow(4.125, 2.125, 4.125), $this) as $entity){ + foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){ if($entity instanceof Living){ $distanceSquared = $entity->distanceSquared($this); if($distanceSquared > 16){ //4 blocks diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index a7284afaa..10acf678e 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1185,7 +1185,7 @@ class Level implements ChunkManager, Metadatable{ } if($entities){ - foreach($this->getCollidingEntities($bb->grow(0.25, 0.25, 0.25), $entity) as $ent){ + foreach($this->getCollidingEntities($bb->expandedCopy(0.25, 0.25, 0.25), $entity) as $ent){ $collides[] = clone $ent->boundingBox; } } @@ -1818,7 +1818,7 @@ class Level implements ChunkManager, Metadatable{ if($player !== null){ if(($diff = $player->getNextPosition()->subtract($player->getPosition())) and $diff->lengthSquared() > 0.00001){ - $bb = $player->getBoundingBox()->getOffsetBoundingBox($diff->x, $diff->y, $diff->z); + $bb = $player->getBoundingBox()->offsetCopy($diff->x, $diff->y, $diff->z); if($collisionBox->intersectsWith($bb)){ return false; //Inside player BB }