本文整理匯總了PHP中pocketmine\entity\Entity::setDataFlag方法的典型用法代碼示例。如果您正苦於以下問題:PHP Entity::setDataFlag方法的具體用法?PHP Entity::setDataFlag怎麽用?PHP Entity::setDataFlag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pocketmine\entity\Entity
的用法示例。
在下文中一共展示了Entity::setDataFlag方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: remove
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);
}
}
示例2: remove
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);
}
if ($this->id === Effect::INVISIBILITY) {
$entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false);
$entity->setNameTagVisible(true);
} elseif ($this->id === Effect::SPEED) {
$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);
$attr->setValue($attr->getValue() / (1 + 0.2 * $this->amplifier));
} elseif ($this->id === Effect::SLOWNESS) {
$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);
$attr->setValue($attr->getValue() / (1 - 0.15 * $this->amplifier));
}
}
示例3: remove
public function remove(Entity $entity)
{
Server::getInstance()->getPluginManager()->callEvent($ev = new RemoveEffectEvent($entity, $this));
if ($ev->isCancelled) {
return false;
}
if ($entity instanceof Player) {
$pk = new MobEffectPacket();
$pk->eid = 0;
$pk->eventId = MobEffectPacket::EVENT_REMOVE;
$pk->effectId = $this->getId();
$entity->dataPacket($pk);
}
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);
}
}
示例4: remove
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);
if ($this->id === Effect::SPEED or $this->id === Effect::SLOWNESS) {
if ($entity instanceof Player) {
$entity->setMovementSpeed(0.1);
}
}
}
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);
}
}