From 66edf5a1650f87d33de8cc5badcdbd25d5c13af0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 31 Oct 2020 15:51:17 +0000 Subject: [PATCH] Particle::encode() now always returns ClientboundPacket[] --- src/world/World.php | 3 --- src/world/particle/AngryVillagerParticle.php | 4 ++-- src/world/particle/BlockForceFieldParticle.php | 4 ++-- src/world/particle/BlockPunchParticle.php | 4 ++-- src/world/particle/BubbleParticle.php | 4 ++-- src/world/particle/CriticalParticle.php | 4 ++-- src/world/particle/DestroyBlockParticle.php | 4 ++-- src/world/particle/DragonEggTeleportParticle.php | 4 ++-- src/world/particle/DustParticle.php | 4 ++-- src/world/particle/EnchantParticle.php | 4 ++-- src/world/particle/EnchantmentTableParticle.php | 4 ++-- src/world/particle/EndermanTeleportParticle.php | 4 ++-- src/world/particle/EntityFlameParticle.php | 4 ++-- src/world/particle/ExplodeParticle.php | 4 ++-- src/world/particle/FlameParticle.php | 4 ++-- src/world/particle/FloatingTextParticle.php | 2 +- src/world/particle/HappyVillagerParticle.php | 4 ++-- src/world/particle/HeartParticle.php | 4 ++-- src/world/particle/HugeExplodeParticle.php | 4 ++-- src/world/particle/HugeExplodeSeedParticle.php | 4 ++-- src/world/particle/InkParticle.php | 4 ++-- src/world/particle/InstantEnchantParticle.php | 4 ++-- src/world/particle/ItemBreakParticle.php | 4 ++-- src/world/particle/LavaDripParticle.php | 4 ++-- src/world/particle/LavaParticle.php | 4 ++-- src/world/particle/MobSpawnParticle.php | 4 ++-- src/world/particle/Particle.php | 4 ++-- src/world/particle/PortalParticle.php | 4 ++-- src/world/particle/PotionSplashParticle.php | 4 ++-- src/world/particle/RainSplashParticle.php | 4 ++-- src/world/particle/RedstoneParticle.php | 4 ++-- src/world/particle/SmokeParticle.php | 4 ++-- src/world/particle/SnowballPoofParticle.php | 4 ++-- src/world/particle/SplashParticle.php | 4 ++-- src/world/particle/SporeParticle.php | 4 ++-- src/world/particle/TerrainParticle.php | 4 ++-- src/world/particle/WaterDripParticle.php | 4 ++-- src/world/particle/WaterParticle.php | 4 ++-- 38 files changed, 73 insertions(+), 76 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index ed1e3da1e..8bfa1cf10 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -493,9 +493,6 @@ class World implements ChunkManager{ */ public function addParticle(Vector3 $pos, Particle $particle, ?array $players = null) : void{ $pk = $particle->encode($pos); - if(!is_array($pk)){ - $pk = [$pk]; - } if(count($pk) > 0){ if($players === null){ foreach($pk as $e){ diff --git a/src/world/particle/AngryVillagerParticle.php b/src/world/particle/AngryVillagerParticle.php index 5ea0ea204..67e7805ab 100644 --- a/src/world/particle/AngryVillagerParticle.php +++ b/src/world/particle/AngryVillagerParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class AngryVillagerParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::VILLAGER_ANGRY, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::VILLAGER_ANGRY, 0, $pos)]; } } diff --git a/src/world/particle/BlockForceFieldParticle.php b/src/world/particle/BlockForceFieldParticle.php index 24d07d30f..cfd2d0b2a 100644 --- a/src/world/particle/BlockForceFieldParticle.php +++ b/src/world/particle/BlockForceFieldParticle.php @@ -36,7 +36,7 @@ class BlockForceFieldParticle implements Particle{ $this->data = $data; //TODO: proper encode/decode of data } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::BLOCK_FORCE_FIELD, $this->data, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::BLOCK_FORCE_FIELD, $this->data, $pos)]; } } diff --git a/src/world/particle/BlockPunchParticle.php b/src/world/particle/BlockPunchParticle.php index be99c9452..e0a7eaaf8 100644 --- a/src/world/particle/BlockPunchParticle.php +++ b/src/world/particle/BlockPunchParticle.php @@ -43,7 +43,7 @@ class BlockPunchParticle implements Particle{ $this->face = $face; } - public function encode(Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) | ($this->face << 24), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()) | ($this->face << 24), $pos)]; } } diff --git a/src/world/particle/BubbleParticle.php b/src/world/particle/BubbleParticle.php index 62deede8a..90336a923 100644 --- a/src/world/particle/BubbleParticle.php +++ b/src/world/particle/BubbleParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class BubbleParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::BUBBLE, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::BUBBLE, 0, $pos)]; } } diff --git a/src/world/particle/CriticalParticle.php b/src/world/particle/CriticalParticle.php index 970564585..477d1c7e5 100644 --- a/src/world/particle/CriticalParticle.php +++ b/src/world/particle/CriticalParticle.php @@ -35,7 +35,7 @@ class CriticalParticle implements Particle{ $this->scale = $scale; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::CRITICAL, $this->scale, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::CRITICAL, $this->scale, $pos)]; } } diff --git a/src/world/particle/DestroyBlockParticle.php b/src/world/particle/DestroyBlockParticle.php index d43b84850..aeda3f484 100644 --- a/src/world/particle/DestroyBlockParticle.php +++ b/src/world/particle/DestroyBlockParticle.php @@ -37,7 +37,7 @@ class DestroyBlockParticle implements Particle{ $this->block = $b; } - public function encode(Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DESTROY, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)]; } } diff --git a/src/world/particle/DragonEggTeleportParticle.php b/src/world/particle/DragonEggTeleportParticle.php index b8a615f8e..5c17650da 100644 --- a/src/world/particle/DragonEggTeleportParticle.php +++ b/src/world/particle/DragonEggTeleportParticle.php @@ -49,7 +49,7 @@ class DragonEggTeleportParticle implements Particle{ return $v; } - public function encode(Vector3 $pos){ + public function encode(Vector3 $pos) : array{ $data = ($this->zDiff < 0 ? 1 << 26 : 0) | ($this->yDiff < 0 ? 1 << 25 : 0) | ($this->xDiff < 0 ? 1 << 24 : 0) | @@ -57,6 +57,6 @@ class DragonEggTeleportParticle implements Particle{ (abs($this->yDiff) << 8) | abs($this->zDiff); - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DRAGON_EGG_TELEPORT, $data, $pos); + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_DRAGON_EGG_TELEPORT, $data, $pos)]; } } diff --git a/src/world/particle/DustParticle.php b/src/world/particle/DustParticle.php index 27a7d742f..4e0564910 100644 --- a/src/world/particle/DustParticle.php +++ b/src/world/particle/DustParticle.php @@ -36,7 +36,7 @@ class DustParticle implements Particle{ $this->color = $color; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::DUST, $this->color->toARGB(), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::DUST, $this->color->toARGB(), $pos)]; } } diff --git a/src/world/particle/EnchantParticle.php b/src/world/particle/EnchantParticle.php index db42ea309..48f223ae9 100644 --- a/src/world/particle/EnchantParticle.php +++ b/src/world/particle/EnchantParticle.php @@ -37,7 +37,7 @@ class EnchantParticle implements Particle{ $this->color = $color; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL, $this->color->toARGB(), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL, $this->color->toARGB(), $pos)]; } } diff --git a/src/world/particle/EnchantmentTableParticle.php b/src/world/particle/EnchantmentTableParticle.php index 15ac7d14b..86a86f572 100644 --- a/src/world/particle/EnchantmentTableParticle.php +++ b/src/world/particle/EnchantmentTableParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class EnchantmentTableParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::ENCHANTMENT_TABLE, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::ENCHANTMENT_TABLE, 0, $pos)]; } } diff --git a/src/world/particle/EndermanTeleportParticle.php b/src/world/particle/EndermanTeleportParticle.php index 18689d9a9..274d1540e 100644 --- a/src/world/particle/EndermanTeleportParticle.php +++ b/src/world/particle/EndermanTeleportParticle.php @@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\LevelEventPacket; class EndermanTeleportParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_ENDERMAN_TELEPORT, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_ENDERMAN_TELEPORT, 0, $pos)]; } } diff --git a/src/world/particle/EntityFlameParticle.php b/src/world/particle/EntityFlameParticle.php index 66c4ba4c2..3f5a98740 100644 --- a/src/world/particle/EntityFlameParticle.php +++ b/src/world/particle/EntityFlameParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class EntityFlameParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::MOB_FLAME, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::MOB_FLAME, 0, $pos)]; } } diff --git a/src/world/particle/ExplodeParticle.php b/src/world/particle/ExplodeParticle.php index 8a51a13de..d3e8b566c 100644 --- a/src/world/particle/ExplodeParticle.php +++ b/src/world/particle/ExplodeParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class ExplodeParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::EXPLODE, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::EXPLODE, 0, $pos)]; } } diff --git a/src/world/particle/FlameParticle.php b/src/world/particle/FlameParticle.php index f78681c8e..d713df67c 100644 --- a/src/world/particle/FlameParticle.php +++ b/src/world/particle/FlameParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class FlameParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::FLAME, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::FLAME, 0, $pos)]; } } diff --git a/src/world/particle/FloatingTextParticle.php b/src/world/particle/FloatingTextParticle.php index 5b787580a..bca601389 100644 --- a/src/world/particle/FloatingTextParticle.php +++ b/src/world/particle/FloatingTextParticle.php @@ -80,7 +80,7 @@ class FloatingTextParticle implements Particle{ $this->invisible = $value; } - public function encode(Vector3 $pos){ + public function encode(Vector3 $pos) : array{ $p = []; if($this->entityId === null){ diff --git a/src/world/particle/HappyVillagerParticle.php b/src/world/particle/HappyVillagerParticle.php index d6e03881b..d405a6037 100644 --- a/src/world/particle/HappyVillagerParticle.php +++ b/src/world/particle/HappyVillagerParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class HappyVillagerParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::VILLAGER_HAPPY, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::VILLAGER_HAPPY, 0, $pos)]; } } diff --git a/src/world/particle/HeartParticle.php b/src/world/particle/HeartParticle.php index b3a76baa5..4d2dddbfe 100644 --- a/src/world/particle/HeartParticle.php +++ b/src/world/particle/HeartParticle.php @@ -35,7 +35,7 @@ class HeartParticle implements Particle{ $this->scale = $scale; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::HEART, $this->scale, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::HEART, $this->scale, $pos)]; } } diff --git a/src/world/particle/HugeExplodeParticle.php b/src/world/particle/HugeExplodeParticle.php index 5f9b0c6e7..3f1c109f9 100644 --- a/src/world/particle/HugeExplodeParticle.php +++ b/src/world/particle/HugeExplodeParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class HugeExplodeParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::HUGE_EXPLODE, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::HUGE_EXPLODE, 0, $pos)]; } } diff --git a/src/world/particle/HugeExplodeSeedParticle.php b/src/world/particle/HugeExplodeSeedParticle.php index d27db8875..e35fbc94f 100644 --- a/src/world/particle/HugeExplodeSeedParticle.php +++ b/src/world/particle/HugeExplodeSeedParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class HugeExplodeSeedParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::HUGE_EXPLODE_SEED, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::HUGE_EXPLODE_SEED, 0, $pos)]; } } diff --git a/src/world/particle/InkParticle.php b/src/world/particle/InkParticle.php index c99c07ce8..dfe6a5fd7 100644 --- a/src/world/particle/InkParticle.php +++ b/src/world/particle/InkParticle.php @@ -35,7 +35,7 @@ class InkParticle implements Particle{ $this->scale = $scale; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::INK, $this->scale, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::INK, $this->scale, $pos)]; } } diff --git a/src/world/particle/InstantEnchantParticle.php b/src/world/particle/InstantEnchantParticle.php index 17156d1ef..695a4780a 100644 --- a/src/world/particle/InstantEnchantParticle.php +++ b/src/world/particle/InstantEnchantParticle.php @@ -36,7 +36,7 @@ class InstantEnchantParticle implements Particle{ $this->color = $color; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL_INSTANTANEOUS, $this->color->toARGB(), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::MOB_SPELL_INSTANTANEOUS, $this->color->toARGB(), $pos)]; } } diff --git a/src/world/particle/ItemBreakParticle.php b/src/world/particle/ItemBreakParticle.php index 7ebee7b0e..1a4865a6a 100644 --- a/src/world/particle/ItemBreakParticle.php +++ b/src/world/particle/ItemBreakParticle.php @@ -36,7 +36,7 @@ class ItemBreakParticle implements Particle{ $this->item = $item; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::ITEM_BREAK, ($this->item->getId() << 16) | $this->item->getMeta(), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::ITEM_BREAK, ($this->item->getId() << 16) | $this->item->getMeta(), $pos)]; } } diff --git a/src/world/particle/LavaDripParticle.php b/src/world/particle/LavaDripParticle.php index 485c8004b..904d5257b 100644 --- a/src/world/particle/LavaDripParticle.php +++ b/src/world/particle/LavaDripParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class LavaDripParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::DRIP_LAVA, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::DRIP_LAVA, 0, $pos)]; } } diff --git a/src/world/particle/LavaParticle.php b/src/world/particle/LavaParticle.php index fede3825e..dcf9572a9 100644 --- a/src/world/particle/LavaParticle.php +++ b/src/world/particle/LavaParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class LavaParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::LAVA, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::LAVA, 0, $pos)]; } } diff --git a/src/world/particle/MobSpawnParticle.php b/src/world/particle/MobSpawnParticle.php index 6ebe243a2..bdc2f0144 100644 --- a/src/world/particle/MobSpawnParticle.php +++ b/src/world/particle/MobSpawnParticle.php @@ -38,7 +38,7 @@ class MobSpawnParticle implements Particle{ $this->height = $height; } - public function encode(Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPAWN, ($this->width & 0xff) | (($this->height & 0xff) << 8), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPAWN, ($this->width & 0xff) | (($this->height & 0xff) << 8), $pos)]; } } diff --git a/src/world/particle/Particle.php b/src/world/particle/Particle.php index 4ed80a7c0..009bb948d 100644 --- a/src/world/particle/Particle.php +++ b/src/world/particle/Particle.php @@ -29,8 +29,8 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket; interface Particle{ /** - * @return ClientboundPacket|ClientboundPacket[] + * @return ClientboundPacket[] */ - public function encode(Vector3 $pos); + public function encode(Vector3 $pos) : array; } diff --git a/src/world/particle/PortalParticle.php b/src/world/particle/PortalParticle.php index c45c8eaa3..627ff969a 100644 --- a/src/world/particle/PortalParticle.php +++ b/src/world/particle/PortalParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class PortalParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::PORTAL, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::PORTAL, 0, $pos)]; } } diff --git a/src/world/particle/PotionSplashParticle.php b/src/world/particle/PotionSplashParticle.php index 6c7fc67c3..83ad8c699 100644 --- a/src/world/particle/PotionSplashParticle.php +++ b/src/world/particle/PotionSplashParticle.php @@ -49,7 +49,7 @@ class PotionSplashParticle implements Particle{ return $this->color; } - public function encode(Vector3 $pos){ - return LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPLASH, $this->color->toARGB(), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::create(LevelEventPacket::EVENT_PARTICLE_SPLASH, $this->color->toARGB(), $pos)]; } } diff --git a/src/world/particle/RainSplashParticle.php b/src/world/particle/RainSplashParticle.php index 1178557d6..8ba67a4ed 100644 --- a/src/world/particle/RainSplashParticle.php +++ b/src/world/particle/RainSplashParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class RainSplashParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::RAIN_SPLASH, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::RAIN_SPLASH, 0, $pos)]; } } diff --git a/src/world/particle/RedstoneParticle.php b/src/world/particle/RedstoneParticle.php index 4336f01f9..f969bcaab 100644 --- a/src/world/particle/RedstoneParticle.php +++ b/src/world/particle/RedstoneParticle.php @@ -35,7 +35,7 @@ class RedstoneParticle implements Particle{ $this->lifetime = $lifetime; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::REDSTONE, $this->lifetime, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::REDSTONE, $this->lifetime, $pos)]; } } diff --git a/src/world/particle/SmokeParticle.php b/src/world/particle/SmokeParticle.php index 3d9f3f9fa..999f7ffd2 100644 --- a/src/world/particle/SmokeParticle.php +++ b/src/world/particle/SmokeParticle.php @@ -35,7 +35,7 @@ class SmokeParticle implements Particle{ $this->scale = $scale; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::SMOKE, $this->scale, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::SMOKE, $this->scale, $pos)]; } } diff --git a/src/world/particle/SnowballPoofParticle.php b/src/world/particle/SnowballPoofParticle.php index e82726d1c..1d764238e 100644 --- a/src/world/particle/SnowballPoofParticle.php +++ b/src/world/particle/SnowballPoofParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class SnowballPoofParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::SNOWBALL_POOF, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::SNOWBALL_POOF, 0, $pos)]; } } diff --git a/src/world/particle/SplashParticle.php b/src/world/particle/SplashParticle.php index 171e1b3cb..dbc397122 100644 --- a/src/world/particle/SplashParticle.php +++ b/src/world/particle/SplashParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class SplashParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::WATER_SPLASH, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::WATER_SPLASH, 0, $pos)]; } } diff --git a/src/world/particle/SporeParticle.php b/src/world/particle/SporeParticle.php index d8ef499c8..472cb6b1b 100644 --- a/src/world/particle/SporeParticle.php +++ b/src/world/particle/SporeParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class SporeParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::TOWN_AURA, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::TOWN_AURA, 0, $pos)]; } } diff --git a/src/world/particle/TerrainParticle.php b/src/world/particle/TerrainParticle.php index 4b9f07c66..5805662e9 100644 --- a/src/world/particle/TerrainParticle.php +++ b/src/world/particle/TerrainParticle.php @@ -37,7 +37,7 @@ class TerrainParticle implements Particle{ $this->block = $b; } - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::TERRAIN, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::TERRAIN, RuntimeBlockMapping::getInstance()->toRuntimeId($this->block->getFullId()), $pos)]; } } diff --git a/src/world/particle/WaterDripParticle.php b/src/world/particle/WaterDripParticle.php index 71677252a..a1072dc6e 100644 --- a/src/world/particle/WaterDripParticle.php +++ b/src/world/particle/WaterDripParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class WaterDripParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::DRIP_WATER, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::DRIP_WATER, 0, $pos)]; } } diff --git a/src/world/particle/WaterParticle.php b/src/world/particle/WaterParticle.php index 71beaaab3..93ef6efb7 100644 --- a/src/world/particle/WaterParticle.php +++ b/src/world/particle/WaterParticle.php @@ -29,7 +29,7 @@ use pocketmine\network\mcpe\protocol\types\ParticleIds; class WaterParticle implements Particle{ - public function encode(Vector3 $pos){ - return LevelEventPacket::standardParticle(ParticleIds::WATER_WAKE, 0, $pos); + public function encode(Vector3 $pos) : array{ + return [LevelEventPacket::standardParticle(ParticleIds::WATER_WAKE, 0, $pos)]; } }