mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Modernize property declarations in src/world/particle
This commit is contained in:
parent
6d7bf1c5d8
commit
cb76c149e1
@ -30,15 +30,10 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelEvent;
|
||||
|
||||
class BlockBreakParticle implements Particle{
|
||||
|
||||
/** @var Block */
|
||||
private $block;
|
||||
|
||||
public function __construct(Block $b){
|
||||
$this->block = $b;
|
||||
}
|
||||
//TODO: rename this parameter when we can break BC
|
||||
public function __construct(private Block $b){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::create(LevelEvent::PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)];
|
||||
return [LevelEventPacket::create(LevelEvent::PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->b->getFullId()), $pos)];
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +28,8 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class BlockForceFieldParticle implements Particle{
|
||||
|
||||
/** @var int */
|
||||
private $data;
|
||||
|
||||
public function __construct(int $data = 0){
|
||||
$this->data = $data; //TODO: proper encode/decode of data
|
||||
}
|
||||
//TODO: proper encode/decode of data
|
||||
public function __construct(private int $data = 0){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::BLOCK_FORCE_FIELD, $this->data, $pos)];
|
||||
|
@ -33,16 +33,10 @@ use pocketmine\network\mcpe\protocol\types\LevelEvent;
|
||||
* This particle appears when a player is attacking a block face in survival mode attempting to break it.
|
||||
*/
|
||||
class BlockPunchParticle implements Particle{
|
||||
|
||||
/** @var Block */
|
||||
private $block;
|
||||
/** @var int */
|
||||
private $face;
|
||||
|
||||
public function __construct(Block $block, int $face){
|
||||
$this->block = $block;
|
||||
$this->face = $face;
|
||||
}
|
||||
public function __construct(
|
||||
private Block $block,
|
||||
private int $face
|
||||
){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::create(LevelEvent::PARTICLE_PUNCH_BLOCK, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) | ($this->face << 24), $pos)];
|
||||
|
@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class CriticalParticle implements Particle{
|
||||
/** @var int */
|
||||
private $scale;
|
||||
|
||||
public function __construct(int $scale = 2){
|
||||
$this->scale = $scale;
|
||||
}
|
||||
public function __construct(private int $scale = 2){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::CRITICAL, $this->scale, $pos)];
|
||||
|
@ -30,12 +30,9 @@ use function abs;
|
||||
|
||||
class DragonEggTeleportParticle implements Particle{
|
||||
|
||||
/** @var int */
|
||||
private $xDiff;
|
||||
/** @var int */
|
||||
private $yDiff;
|
||||
/** @var int */
|
||||
private $zDiff;
|
||||
private int $xDiff;
|
||||
private int $yDiff;
|
||||
private int $zDiff;
|
||||
|
||||
public function __construct(int $xDiff, int $yDiff, int $zDiff){
|
||||
$this->xDiff = self::boundOrThrow($xDiff);
|
||||
|
@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class DustParticle implements Particle{
|
||||
/** @var Color */
|
||||
private $color;
|
||||
|
||||
public function __construct(Color $color){
|
||||
$this->color = $color;
|
||||
}
|
||||
public function __construct(private Color $color){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::DUST, $this->color->toARGB(), $pos)];
|
||||
|
@ -29,13 +29,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class EnchantParticle implements Particle{
|
||||
|
||||
/** @var Color */
|
||||
private $color;
|
||||
|
||||
public function __construct(Color $color){
|
||||
$this->color = $color;
|
||||
}
|
||||
public function __construct(private Color $color){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL, $this->color->toARGB(), $pos)];
|
||||
|
@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class HeartParticle implements Particle{
|
||||
/** @var int */
|
||||
private $scale;
|
||||
|
||||
public function __construct(int $scale = 0){
|
||||
$this->scale = $scale;
|
||||
}
|
||||
public function __construct(private int $scale = 0){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::HEART, $this->scale, $pos)];
|
||||
|
@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class InkParticle implements Particle{
|
||||
/** @var int */
|
||||
private $scale;
|
||||
|
||||
public function __construct(int $scale = 0){
|
||||
$this->scale = $scale;
|
||||
}
|
||||
public function __construct(private int $scale = 0){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::INK, $this->scale, $pos)];
|
||||
|
@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class InstantEnchantParticle implements Particle{
|
||||
/** @var Color */
|
||||
private $color;
|
||||
|
||||
public function __construct(Color $color){
|
||||
$this->color = $color;
|
||||
}
|
||||
public function __construct(private Color $color){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL_INSTANTANEOUS, $this->color->toARGB(), $pos)];
|
||||
|
@ -29,12 +29,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class ItemBreakParticle implements Particle{
|
||||
/** @var Item */
|
||||
private $item;
|
||||
|
||||
public function __construct(Item $item){
|
||||
$this->item = $item;
|
||||
}
|
||||
public function __construct(private Item $item){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::ITEM_BREAK, ($this->item->getId() << 16) | $this->item->getMeta(), $pos)];
|
||||
|
@ -29,13 +29,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelEvent;
|
||||
|
||||
class PotionSplashParticle implements Particle{
|
||||
|
||||
/** @var Color */
|
||||
private $color;
|
||||
|
||||
public function __construct(Color $color){
|
||||
$this->color = $color;
|
||||
}
|
||||
public function __construct(private Color $color){}
|
||||
|
||||
/**
|
||||
* Returns the default water-bottle splash colour.
|
||||
|
@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class RedstoneParticle implements Particle{
|
||||
/** @var int */
|
||||
private $lifetime;
|
||||
|
||||
public function __construct(int $lifetime = 1){
|
||||
$this->lifetime = $lifetime;
|
||||
}
|
||||
public function __construct(private int $lifetime = 1){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::REDSTONE, $this->lifetime, $pos)];
|
||||
|
@ -28,12 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class SmokeParticle implements Particle{
|
||||
/** @var int */
|
||||
private $scale;
|
||||
|
||||
public function __construct(int $scale = 0){
|
||||
$this->scale = $scale;
|
||||
}
|
||||
public function __construct(private int $scale = 0){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::SMOKE, $this->scale, $pos)];
|
||||
|
@ -30,14 +30,9 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ParticleIds;
|
||||
|
||||
class TerrainParticle implements Particle{
|
||||
/** @var Block */
|
||||
private $block;
|
||||
|
||||
public function __construct(Block $b){
|
||||
$this->block = $b;
|
||||
}
|
||||
public function __construct(private Block $b){}
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::TERRAIN, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)];
|
||||
return [LevelEventPacket::standardParticle(ParticleIds::TERRAIN, RuntimeBlockMapping::getInstance()->toRuntimeId($this->b->getFullId()), $pos)];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user