Inheritance: extends DataPacket
Example #1
0
 public function remove(Entity $entity)
 {
     if ($entity instanceof Player) {
         $pk = new MobEffectPacket();
         $pk->eid = 0;
         $pk->eventId = MobEffectPacket::EVENT_REMOVE;
         $pk->effectId = $this->getId();
         $entity->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
     }
     if ($this->id === Effect::INVISIBILITY) {
         $entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false);
         $entity->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 1);
     }
 }
Example #2
0
 public function sendPotionEffects(Player $player)
 {
     foreach ($this->effects as $effect) {
         $pk = new MobEffectPacket();
         $pk->eid = $this->getId();
         $pk->effectId = $effect->getId();
         $pk->amplifier = $effect->getAmplifier();
         $pk->particles = $effect->isVisible();
         $pk->duration = $effect->getDuration();
         $pk->eventId = MobEffectPacket::EVENT_ADD;
         $player->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
     }
 }