remove GenericParticle, work on isolating network crap in particles

This commit is contained in:
Dylan K. Taylor
2019-08-19 19:26:26 +01:00
parent 4dfa335ae7
commit 8557c93f04
30 changed files with 220 additions and 121 deletions

View File

@ -24,10 +24,19 @@ declare(strict_types=1);
namespace pocketmine\world\particle;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\types\ParticleIds;
class ItemBreakParticle extends GenericParticle{
class ItemBreakParticle implements Particle{
/** @var Item */
private $item;
public function __construct(Item $item){
parent::__construct(ParticleIds::ITEM_BREAK, ($item->getId() << 16) | $item->getMeta());
$this->item = $item;
}
public function encode(Vector3 $pos){
return LevelEventPacket::standardParticle(ParticleIds::ITEM_BREAK, ($this->item->getId() << 16) | $this->item->getMeta(), $pos);
}
}