Modernize property declarations in src/entity/animation

This commit is contained in:
Dylan K. Taylor 2022-04-28 15:33:13 +01:00
parent b88a47929f
commit 20ff5d5a3d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
9 changed files with 17 additions and 62 deletions

View File

@ -29,12 +29,8 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class ArmSwingAnimation implements Animation{
/** @var Living */
private $entity; //TODO: not sure if this should be constrained to humanoids, but we don't have any concept of that right now
public function __construct(Living $entity){
$this->entity = $entity;
}
//TODO: not sure if this should be constrained to humanoids, but we don't have any concept of that right now
public function __construct(private Living $entity){}
public function encode() : array{
return [

View File

@ -29,15 +29,10 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
class ArrowShakeAnimation implements Animation{
/** @var Arrow */
private $arrow;
/** @var int */
private $durationInTicks;
public function __construct(Arrow $arrow, int $durationInTicks){
$this->arrow = $arrow;
$this->durationInTicks = $durationInTicks;
}
public function __construct(
private Arrow $arrow,
private int $durationInTicks
){}
public function encode() : array{
return [

View File

@ -31,16 +31,10 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class ConsumingItemAnimation implements Animation{
/** @var Human */
private $human;
/** @var Item */
private $item;
public function __construct(Human $human, Item $item){
//TODO: maybe this can be expanded to more than just player entities?
$this->human = $human;
$this->item = $item;
}
public function __construct(
private Human $human, //TODO: maybe this can be expanded to more than just player entities?
private Item $item
){}
public function encode() : array{
[$netId, $netData] = ItemTranslator::getInstance()->toNetworkId($this->item->getId(), $this->item->getMeta());

View File

@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\AnimatePacket;
final class CriticalHitAnimation implements Animation{
/** @var Living */
private $entity;
public function __construct(Living $entity){
$this->entity = $entity;
}
public function __construct(private Living $entity){}
public function encode() : array{
return [

View File

@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class DeathAnimation implements Animation{
/** @var Living */
private $entity;
public function __construct(Living $entity){
$this->entity = $entity;
}
public function __construct(private Living $entity){}
public function encode() : array{
return [

View File

@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class HurtAnimation implements Animation{
/** @var Living */
private $entity;
public function __construct(Living $entity){
$this->entity = $entity;
}
public function __construct(private Living $entity){}
public function encode() : array{
return [

View File

@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class RespawnAnimation implements Animation{
/** @var Living */
private $entity;
public function __construct(Living $entity){
$this->entity = $entity;
}
public function __construct(private Living $entity){}
public function encode() : array{
return [

View File

@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class SquidInkCloudAnimation implements Animation{
/** @var Squid */
private $squid;
public function __construct(Squid $squid){
$this->squid = $squid;
}
public function __construct(private Squid $squid){}
public function encode() : array{
return [

View File

@ -29,13 +29,8 @@ use pocketmine\network\mcpe\protocol\types\ActorEvent;
final class TotemUseAnimation implements Animation{
/** @var Human */
private $human;
public function __construct(Human $human){
//TODO: check if this can be expanded to more than just humans
$this->human = $human;
}
//TODO: check if this can be expanded to more than just humans
public function __construct(private Human $human){}
public function encode() : array{
return [