Skip to content

Commit

Permalink
Optimize Imports
Browse files Browse the repository at this point in the history
  • Loading branch information
phoshp committed Jan 8, 2019
1 parent 0cb1d25 commit 5f81262
Show file tree
Hide file tree
Showing 31 changed files with 75 additions and 51 deletions.
1 change: 1 addition & 0 deletions src/pocketmine/entity/Animal.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\Player;
use function max;

abstract class Animal extends Mob implements Ageable{

Expand Down
13 changes: 4 additions & 9 deletions src/pocketmine/entity/Mob.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@

namespace pocketmine\entity;


use pocketmine\entity\behavior\BehaviorPool;
use pocketmine\entity\pathfinder\EntityNavigator;
use pocketmine\item\Lead;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\math\VoxelRayTrace;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\network\mcpe\protocol\PlaySoundPacket;
use pocketmine\Player;
use pocketmine\timings\Timings;
use function abs;
use function boolval;
use function in_array;
use function intval;

abstract class Mob extends Living{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/Monster.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use pocketmine\level\Level;
use pocketmine\math\Vector3;
use function max;

abstract class Monster extends Mob{

Expand Down
2 changes: 2 additions & 0 deletions src/pocketmine/entity/Tamable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\utils\UUID;
use function boolval;
use function intval;

abstract class Tamable extends Animal{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/behavior/BehaviorPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace pocketmine\entity\behavior;

use pocketmine\Server;
use function spl_object_hash;

class BehaviorPool{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/behavior/EatBlockBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use pocketmine\level\GameRules;
use pocketmine\level\particle\DestroyBlockParticle;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use function max;

class EatBlockBehavior extends Behavior{

Expand Down
4 changes: 1 addition & 3 deletions src/pocketmine/entity/behavior/FleeSunBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
namespace pocketmine\entity\behavior;

use pocketmine\block\Block;
use pocketmine\block\Grass;
use pocketmine\entity\Animal;
use pocketmine\block\Water;
use pocketmine\entity\Entity;
use pocketmine\entity\Mob;
use pocketmine\math\Vector3;
use pocketmine\block\Water;

class FleeSunBehavior extends Behavior{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/behavior/FollowOwnerBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use pocketmine\entity\Tamable;
use pocketmine\Player;


class FollowOwnerBehavior extends Behavior{

/** @var float */
Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/behavior/MeleeAttackBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\math\Vector3;
use function max;

class MeleeAttackBehavior extends Behavior{

Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/entity/behavior/RandomLookAroundBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

use pocketmine\entity\Mob;
use pocketmine\math\Vector3;
use function cos;
use function pi;
use function sin;

class RandomLookAroundBehavior extends Behavior{

Expand Down
2 changes: 2 additions & 0 deletions src/pocketmine/entity/behavior/RangedAttackBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
use pocketmine\entity\RangedAttackerMob;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\event\entity\EntityDamageEvent;
use function floor;
use function sqrt;

class RangedAttackBehavior extends Behavior{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/behavior/TemptedBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use pocketmine\entity\Mob;
use pocketmine\Player;
use function in_array;

class TemptedBehavior extends Behavior{

Expand Down
11 changes: 6 additions & 5 deletions src/pocketmine/entity/hostile/Blaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@

namespace pocketmine\entity\hostile;

use pocketmine\entity\Monster;
use pocketmine\entity\projectile\SmallFireball;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\entity\behavior\FindAttackableTargetBehavior;
use pocketmine\entity\behavior\HurtByTargetBehavior;
use pocketmine\entity\behavior\LookAtPlayerBehavior;
use pocketmine\entity\behavior\RandomLookAroundBehavior;
use pocketmine\entity\behavior\RangedAttackBehavior;
use pocketmine\entity\behavior\WanderBehavior;
use pocketmine\entity\Entity;
use pocketmine\entity\Monster;
use pocketmine\entity\projectile\SmallFireball;
use pocketmine\entity\RangedAttackerMob;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use pocketmine\entity\RangedAttackerMob;
use function rand;

class Blaze extends Monster implements RangedAttackerMob{

Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/entity/hostile/Creeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;
use pocketmine\tile\Skull;
use function boolval;
use function intval;
use function rand;

class Creeper extends Monster implements Ageable{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/hostile/Skeleton.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;
use function rand;

class Skeleton extends Monster implements RangedAttackerMob{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/hostile/Spider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use pocketmine\item\ItemFactory;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use function rand;

class Spider extends Monster implements Ageable{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/hostile/Zombie.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use pocketmine\item\ItemFactory;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use function mt_rand;

class Zombie extends Monster implements Ageable{
public const NETWORK_ID = self::ZOMBIE;
Expand Down
3 changes: 2 additions & 1 deletion src/pocketmine/entity/object/ArmorStand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\inventory\AltayEntityEquipment;
use pocketmine\inventory\ArmorInventory;
use pocketmine\inventory\utils\EquipmentSlot;
use pocketmine\item\Armor;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
Expand All @@ -44,6 +43,8 @@
use pocketmine\nbt\tag\ListTag;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\Player;
use function array_merge;
use function min;

class ArmorStand extends Living{

Expand Down
2 changes: 0 additions & 2 deletions src/pocketmine/entity/object/LeashKnot.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\AddEntityPacket;
use pocketmine\network\mcpe\protocol\AddHangingEntityPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;

Expand Down
21 changes: 4 additions & 17 deletions src/pocketmine/entity/passive/AbstractHorse.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,18 @@

namespace pocketmine\entity\passive;

use pocketmine\entity\Animal;
use pocketmine\entity\Attribute;
use pocketmine\entity\behavior\FloatBehavior;
use pocketmine\entity\behavior\FollowParentBehavior;
use pocketmine\entity\behavior\HorseRiddenBehavior;
use pocketmine\entity\behavior\LookAtPlayerBehavior;
use pocketmine\entity\behavior\MateBehavior;
use pocketmine\entity\behavior\PanicBehavior;
use pocketmine\entity\behavior\RandomLookAroundBehavior;
use pocketmine\entity\behavior\TemptedBehavior;
use pocketmine\entity\behavior\WanderBehavior;
use pocketmine\entity\Effect;
use pocketmine\entity\Entity;
use pocketmine\entity\Tamable;
use pocketmine\item\Saddle;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\network\mcpe\protocol\RiderJumpPacket;
use pocketmine\network\mcpe\protocol\UpdateAttributesPacket;
use pocketmine\Player;
use function boolval;
use function intval;
use function mt_rand;

abstract class AbstractHorse extends Tamable{

Expand Down Expand Up @@ -143,7 +130,7 @@ public function onInteract(Player $player, Item $item, Vector3 $clickPos) : bool
}

public function getXpDropAmount() : int{
return rand(1, ($this->isInLove() ? 7 : 3));
return mt_rand(1, ($this->isInLove() ? 7 : 3));
}

public function getDrops() : array{
Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/entity/passive/Chicken.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
use pocketmine\item\ItemFactory;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use function boolval;
use function intval;
use function rand;

class Chicken extends Animal{

Expand Down
2 changes: 1 addition & 1 deletion src/pocketmine/entity/passive/Cow.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
use pocketmine\entity\behavior\TemptedBehavior;
use pocketmine\entity\behavior\WanderBehavior;
use pocketmine\item\Bucket;
use pocketmine\item\MilkBucket;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use function rand;

class Cow extends Animal{

Expand Down
4 changes: 3 additions & 1 deletion src/pocketmine/entity/passive/Pig.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
use pocketmine\entity\behavior\RandomLookAroundBehavior;
use pocketmine\entity\behavior\TemptedBehavior;
use pocketmine\entity\behavior\WanderBehavior;
use pocketmine\item\Saddle;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use function boolval;
use function intval;
use function rand;

class Pig extends Animal{

Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/entity/passive/Sheep.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\Player;
use pocketmine\utils\Random;
use function boolval;
use function intval;
use function rand;

class Sheep extends Animal{

Expand Down
3 changes: 3 additions & 0 deletions src/pocketmine/entity/passive/Villager.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\Player;
use function array_rand;
use function count;
use function mt_rand;

class Villager extends Mob implements NPC, Ageable{

Expand Down
1 change: 1 addition & 0 deletions src/pocketmine/entity/passive/Wolf.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\Player;
use function mt_rand;

class Wolf extends Tamable{
public const NETWORK_ID = self::WOLF;
Expand Down
7 changes: 7 additions & 0 deletions src/pocketmine/entity/pathfinder/EntityNavigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
use pocketmine\math\Vector2;
use pocketmine\math\Vector3;
use pocketmine\timings\Timings;
use function abs;
use function array_unshift;
use function array_values;
use function count;
use function floor;
use function reset;
use function uasort;

class EntityNavigator{

Expand Down
3 changes: 1 addition & 2 deletions src/pocketmine/entity/pathfinder/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

namespace pocketmine\entity\pathfinder;

use pocketmine\entity\Entity;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use function array_slice;

class Path{

Expand Down
7 changes: 6 additions & 1 deletion src/pocketmine/entity/projectile/FishingHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\network\mcpe\protocol\EntityEventPacket;
use pocketmine\Player;
use function cos;
use function floor;
use function mt_rand;
use function sin;
use function sqrt;

class FishingHook extends Projectile{

Expand All @@ -58,7 +63,7 @@ class FishingHook extends Projectile{
protected $ticksCatchable = 0;
protected $ticksCaughtDelay = 0;
protected $ticksCatchableDelay = 0;
/** @var int */
/** @var float */
protected $fishApproachAngle = 0;

public function attack(EntityDamageEvent $source) : void{
Expand Down
3 changes: 2 additions & 1 deletion src/pocketmine/entity/utils/FireworksUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\utils\Random;
use function is_null;

class FireworksUtils{
public const COLOR_BLACK = 0;
Expand Down Expand Up @@ -77,7 +78,7 @@ public static function createExplosion(int $fireworkColor = 0, int $fireworkFade
]);
}

public static function createEntityNBT(Vector3 $pos, ?Vector3 $motion = null, Fireworks $rocket, float $spread = 5.0, ?Random $random = null, ?float $yaw = null, ?float $pitch = null) : CompoundTag{
public static function createEntityNBT(Vector3 $pos, ?Vector3 $motion, Fireworks $rocket, float $spread = 5.0, ?Random $random = null, ?float $yaw = null, ?float $pitch = null) : CompoundTag{
$random = $random ?? new Random();
$pos = $pos->add(0.5, 0, 0.5);
$yaw = $yaw ?? $random->nextBoundedInt(360);
Expand Down
Loading

0 comments on commit 5f81262

Please sign in to comment.