pocketmine\entity\Entity::setDataProperty PHP Method

setDataProperty() public method

public setDataProperty ( integer $id, integer $type, mixed $value ) : boolean
$id integer
$type integer
$value mixed
return boolean
    public function setDataProperty($id, $type, $value)
    {
        if ($this->getDataProperty($id) !== $value) {
            $this->dataProperties[$id] = [$type, $value];
            $this->sendData($this->hasSpawned, [$id => $this->dataProperties[$id]]);
            return true;
        }
        return false;
    }

Usage Example

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);
     }
 }
All Usage Examples Of pocketmine\entity\Entity::setDataProperty