update pocketmine/math, adapt to add() changes

This commit is contained in:
Dylan K. Taylor 2020-05-19 12:26:18 +01:00
parent f0fefecf40
commit 148228e360
8 changed files with 13 additions and 13 deletions

8
composer.lock generated
View File

@ -552,12 +552,12 @@
"source": {
"type": "git",
"url": "https://github.com/pmmp/Math.git",
"reference": "9aa4018635e7d634c535d4c7d9e032c7d905c29d"
"reference": "6d5af66a6c923bd8fad93258f3a1736091225aa1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/Math/zipball/9aa4018635e7d634c535d4c7d9e032c7d905c29d",
"reference": "9aa4018635e7d634c535d4c7d9e032c7d905c29d",
"url": "https://api.github.com/repos/pmmp/Math/zipball/6d5af66a6c923bd8fad93258f3a1736091225aa1",
"reference": "6d5af66a6c923bd8fad93258f3a1736091225aa1",
"shasum": ""
},
"require": {
@ -579,7 +579,7 @@
"LGPL-3.0"
],
"description": "PHP library containing math related code used in PocketMine-MP",
"time": "2020-01-28T14:13:55+00:00"
"time": "2020-05-19T11:19:57+00:00"
},
{
"name": "pocketmine/nbt",

View File

@ -746,7 +746,7 @@ abstract class Entity{
$diffPosition = $this->location->distanceSquared($this->lastLocation);
$diffRotation = ($this->location->yaw - $this->lastLocation->yaw) ** 2 + ($this->location->pitch - $this->lastLocation->pitch) ** 2;
$diffMotion = $this->motion->subtract($this->lastMotion)->lengthSquared();
$diffMotion = $this->motion->subtractVector($this->lastMotion)->lengthSquared();
$still = $this->motion->lengthSquared() == 0.0;
$wasStill = $this->lastMotion->lengthSquared() == 0.0;

View File

@ -69,7 +69,7 @@ class Squid extends WaterAnimal{
$this->swimSpeed = mt_rand(150, 350) / 2000;
$e = $source->getDamager();
if($e !== null){
$this->swimDirection = $this->location->subtract($e->location)->normalize();
$this->swimDirection = $this->location->subtractVector($e->location)->normalize();
}
$this->broadcastAnimation(new SquidInkCloudAnimation($this));

View File

@ -190,7 +190,7 @@ class ExperienceOrb extends Entity{
$this->setTargetPlayer($currentTarget);
if($currentTarget !== null){
$vector = $currentTarget->getPosition()->add(0, $currentTarget->getEyeHeight() / 2, 0)->subtract($this->location)->divide(self::MAX_TARGET_DISTANCE);
$vector = $currentTarget->getPosition()->add(0, $currentTarget->getEyeHeight() / 2, 0)->subtractVector($this->location)->divide(self::MAX_TARGET_DISTANCE);
$distance = $vector->lengthSquared();
if($distance < 1){

View File

@ -176,7 +176,7 @@ abstract class Projectile extends Entity{
Timings::$entityMoveTimer->startTiming();
$start = $this->location->asVector3();
$end = $start->add($this->motion);
$end = $start->addVector($this->motion);
$blockHit = null;
$entityHit = null;
@ -196,7 +196,7 @@ abstract class Projectile extends Entity{
$entityDistance = PHP_INT_MAX;
$newDiff = $end->subtract($start);
$newDiff = $end->subtractVector($start);
foreach($this->getWorld()->getCollidingEntities($this->boundingBox->addCoord($newDiff->x, $newDiff->y, $newDiff->z)->expand(1, 1, 1), $this) as $entity){
if($entity->getId() === $this->getOwningEntityId() and $this->ticksLived < 5){
continue;

View File

@ -38,7 +38,7 @@ class KnockbackEnchantment extends MeleeWeaponEnchantment{
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
if($victim instanceof Living){
$diff = $victim->getPosition()->subtract($attacker->getPosition());
$diff = $victim->getPosition()->subtractVector($attacker->getPosition());
$victim->knockBack($diff->x, $diff->z, $enchantmentLevel * 0.5);
}
}

View File

@ -185,7 +185,7 @@ class Explosion{
$distance = $entityPos->distance($this->source) / $explosionSize;
if($distance <= 1){
$motion = $entityPos->subtract($this->source)->normalize();
$motion = $entityPos->subtractVector($this->source)->normalize();
$impact = (1 - $distance) * ($exposure = 1);
@ -241,7 +241,7 @@ class Explosion{
$updateBlocks[$index] = true;
}
}
$send[] = $pos->subtract($source);
$send[] = $pos->subtractVector($source);
}
$this->world->addParticle($source, new HugeExplodeSeedParticle());

View File

@ -1573,7 +1573,7 @@ class World implements ChunkManager{
}
if($player !== null){
if(($diff = $player->getNextPosition()->subtract($player->getPosition())) and $diff->lengthSquared() > 0.00001){
if(($diff = $player->getNextPosition()->subtractVector($player->getPosition())) and $diff->lengthSquared() > 0.00001){
$bb = $player->getBoundingBox()->offsetCopy($diff->x, $diff->y, $diff->z);
if($collisionBox->intersectsWith($bb)){
return false; //Inside player BB