Replace disallowed operators in src/entity/

This commit is contained in:
Dylan K. Taylor
2022-01-20 19:14:28 +00:00
parent be1996752a
commit 8f525ab399
23 changed files with 105 additions and 105 deletions

View File

@ -166,7 +166,7 @@ class ExperienceOrb extends Entity{
}
$currentTarget = $this->getTargetPlayer();
if($currentTarget !== null and (!$currentTarget->isAlive() or !$currentTarget->getXpManager()->canAttractXpOrbs() or $currentTarget->location->distanceSquared($this->location) > self::MAX_TARGET_DISTANCE ** 2)){
if($currentTarget !== null && (!$currentTarget->isAlive() || !$currentTarget->getXpManager()->canAttractXpOrbs() || $currentTarget->location->distanceSquared($this->location) > self::MAX_TARGET_DISTANCE ** 2)){
$currentTarget = null;
}
@ -174,7 +174,7 @@ class ExperienceOrb extends Entity{
if($currentTarget === null){
$newTarget = $this->getWorld()->getNearestEntity($this->location, self::MAX_TARGET_DISTANCE, Human::class);
if($newTarget instanceof Human and !($newTarget instanceof Player and $newTarget->isSpectator()) and $newTarget->getXpManager()->canAttractXpOrbs()){
if($newTarget instanceof Human && !($newTarget instanceof Player && $newTarget->isSpectator()) && $newTarget->getXpManager()->canAttractXpOrbs()){
$currentTarget = $newTarget;
}
}
@ -194,7 +194,7 @@ class ExperienceOrb extends Entity{
$this->motion = $this->motion->addVector($vector->normalize()->multiply(0.2 * (1 - sqrt($distance)) ** 2));
}
if($currentTarget->getXpManager()->canPickupXp() and $this->boundingBox->intersectsWith($currentTarget->getBoundingBox())){
if($currentTarget->getXpManager()->canPickupXp() && $this->boundingBox->intersectsWith($currentTarget->getBoundingBox())){
$this->flagForDespawn();
$currentTarget->getXpManager()->onPickupXp($this->getXpValue());