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