mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
update pocketmine/math, adapt to add() changes
This commit is contained in:
parent
f0fefecf40
commit
148228e360
8
composer.lock
generated
8
composer.lock
generated
@ -552,12 +552,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/Math.git",
|
"url": "https://github.com/pmmp/Math.git",
|
||||||
"reference": "9aa4018635e7d634c535d4c7d9e032c7d905c29d"
|
"reference": "6d5af66a6c923bd8fad93258f3a1736091225aa1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/Math/zipball/9aa4018635e7d634c535d4c7d9e032c7d905c29d",
|
"url": "https://api.github.com/repos/pmmp/Math/zipball/6d5af66a6c923bd8fad93258f3a1736091225aa1",
|
||||||
"reference": "9aa4018635e7d634c535d4c7d9e032c7d905c29d",
|
"reference": "6d5af66a6c923bd8fad93258f3a1736091225aa1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -579,7 +579,7 @@
|
|||||||
"LGPL-3.0"
|
"LGPL-3.0"
|
||||||
],
|
],
|
||||||
"description": "PHP library containing math related code used in PocketMine-MP",
|
"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",
|
"name": "pocketmine/nbt",
|
||||||
|
@ -746,7 +746,7 @@ abstract class Entity{
|
|||||||
$diffPosition = $this->location->distanceSquared($this->lastLocation);
|
$diffPosition = $this->location->distanceSquared($this->lastLocation);
|
||||||
$diffRotation = ($this->location->yaw - $this->lastLocation->yaw) ** 2 + ($this->location->pitch - $this->lastLocation->pitch) ** 2;
|
$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;
|
$still = $this->motion->lengthSquared() == 0.0;
|
||||||
$wasStill = $this->lastMotion->lengthSquared() == 0.0;
|
$wasStill = $this->lastMotion->lengthSquared() == 0.0;
|
||||||
|
@ -69,7 +69,7 @@ class Squid extends WaterAnimal{
|
|||||||
$this->swimSpeed = mt_rand(150, 350) / 2000;
|
$this->swimSpeed = mt_rand(150, 350) / 2000;
|
||||||
$e = $source->getDamager();
|
$e = $source->getDamager();
|
||||||
if($e !== null){
|
if($e !== null){
|
||||||
$this->swimDirection = $this->location->subtract($e->location)->normalize();
|
$this->swimDirection = $this->location->subtractVector($e->location)->normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->broadcastAnimation(new SquidInkCloudAnimation($this));
|
$this->broadcastAnimation(new SquidInkCloudAnimation($this));
|
||||||
|
@ -190,7 +190,7 @@ class ExperienceOrb extends Entity{
|
|||||||
$this->setTargetPlayer($currentTarget);
|
$this->setTargetPlayer($currentTarget);
|
||||||
|
|
||||||
if($currentTarget !== null){
|
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();
|
$distance = $vector->lengthSquared();
|
||||||
if($distance < 1){
|
if($distance < 1){
|
||||||
|
@ -176,7 +176,7 @@ abstract class Projectile extends Entity{
|
|||||||
Timings::$entityMoveTimer->startTiming();
|
Timings::$entityMoveTimer->startTiming();
|
||||||
|
|
||||||
$start = $this->location->asVector3();
|
$start = $this->location->asVector3();
|
||||||
$end = $start->add($this->motion);
|
$end = $start->addVector($this->motion);
|
||||||
|
|
||||||
$blockHit = null;
|
$blockHit = null;
|
||||||
$entityHit = null;
|
$entityHit = null;
|
||||||
@ -196,7 +196,7 @@ abstract class Projectile extends Entity{
|
|||||||
|
|
||||||
$entityDistance = PHP_INT_MAX;
|
$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){
|
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){
|
if($entity->getId() === $this->getOwningEntityId() and $this->ticksLived < 5){
|
||||||
continue;
|
continue;
|
||||||
|
@ -38,7 +38,7 @@ class KnockbackEnchantment extends MeleeWeaponEnchantment{
|
|||||||
|
|
||||||
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
|
public function onPostAttack(Entity $attacker, Entity $victim, int $enchantmentLevel) : void{
|
||||||
if($victim instanceof Living){
|
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);
|
$victim->knockBack($diff->x, $diff->z, $enchantmentLevel * 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ class Explosion{
|
|||||||
$distance = $entityPos->distance($this->source) / $explosionSize;
|
$distance = $entityPos->distance($this->source) / $explosionSize;
|
||||||
|
|
||||||
if($distance <= 1){
|
if($distance <= 1){
|
||||||
$motion = $entityPos->subtract($this->source)->normalize();
|
$motion = $entityPos->subtractVector($this->source)->normalize();
|
||||||
|
|
||||||
$impact = (1 - $distance) * ($exposure = 1);
|
$impact = (1 - $distance) * ($exposure = 1);
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ class Explosion{
|
|||||||
$updateBlocks[$index] = true;
|
$updateBlocks[$index] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$send[] = $pos->subtract($source);
|
$send[] = $pos->subtractVector($source);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->world->addParticle($source, new HugeExplodeSeedParticle());
|
$this->world->addParticle($source, new HugeExplodeSeedParticle());
|
||||||
|
@ -1573,7 +1573,7 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($player !== null){
|
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);
|
$bb = $player->getBoundingBox()->offsetCopy($diff->x, $diff->y, $diff->z);
|
||||||
if($collisionBox->intersectsWith($bb)){
|
if($collisionBox->intersectsWith($bb)){
|
||||||
return false; //Inside player BB
|
return false; //Inside player BB
|
||||||
|
Loading…
x
Reference in New Issue
Block a user