mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Extract mandatory parameters into constructor parameters
the goal is obviously to ditch NBT entirely here, but there's more work to be done before that becomes possible.
This commit is contained in:
@ -26,6 +26,7 @@ namespace pocketmine\entity\projectile;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\entity\animation\ArrowShakeAnimation;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\entity\Location;
|
||||
use pocketmine\event\entity\ProjectileHitEvent;
|
||||
use pocketmine\event\inventory\InventoryPickupArrowEvent;
|
||||
use pocketmine\item\VanillaItems;
|
||||
@ -36,7 +37,6 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\sound\ArrowHitSound;
|
||||
use pocketmine\world\World;
|
||||
use function mt_rand;
|
||||
use function sqrt;
|
||||
|
||||
@ -71,8 +71,8 @@ class Arrow extends Projectile{
|
||||
/** @var bool */
|
||||
protected $critical = false;
|
||||
|
||||
public function __construct(World $world, CompoundTag $nbt, ?Entity $shootingEntity = null, bool $critical = false){
|
||||
parent::__construct($world, $nbt, $shootingEntity);
|
||||
public function __construct(Location $location, ?Entity $shootingEntity, bool $critical, CompoundTag $nbt){
|
||||
parent::__construct($location, $shootingEntity, $nbt);
|
||||
$this->setCritical($critical);
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\entity\Living;
|
||||
use pocketmine\entity\Location;
|
||||
use pocketmine\event\entity\EntityCombustByEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageByChildEntityEvent;
|
||||
use pocketmine\event\entity\EntityDamageByEntityEvent;
|
||||
@ -41,7 +42,6 @@ use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\timings\Timings;
|
||||
use pocketmine\world\World;
|
||||
use function assert;
|
||||
use function atan2;
|
||||
use function ceil;
|
||||
@ -57,8 +57,8 @@ abstract class Projectile extends Entity{
|
||||
/** @var Block|null */
|
||||
protected $blockHit;
|
||||
|
||||
public function __construct(World $world, CompoundTag $nbt, ?Entity $shootingEntity = null){
|
||||
parent::__construct($world, $nbt);
|
||||
public function __construct(Location $location, ?Entity $shootingEntity, CompoundTag $nbt){
|
||||
parent::__construct($location, $nbt);
|
||||
if($shootingEntity !== null){
|
||||
$this->setOwningEntity($shootingEntity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user