本文整理汇总了PHP中pocketmine\entity\Human::setHealth方法的典型用法代码示例。如果您正苦于以下问题:PHP Human::setHealth方法的具体用法?PHP Human::setHealth怎么用?PHP Human::setHealth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\entity\Human
的用法示例。
在下文中一共展示了Human::setHealth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$pk = new SetHealthPacket();
$pk->health = $this->getHealth();
$this->dataPacket($pk);
}
}
示例2: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$this->foodTick = 0;
$this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
if ($amount <= 0) {
$pk = new RespawnPacket();
$pos = $this->getSpawn();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
}
}
}
示例3: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$this->foodTick = 0;
$this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setMaxValue($this->getMaxHealth())->setValue($amount);
}
}
示例4: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$this->foodTick = 0;
if ($amount <= 0) {
$this->kill();
return;
}
$this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
}
}
示例5: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === \true) {
//// if($amount === 20 || $amount === 0) {
// $pk = new SetHealthPacket();
// $pk->health = $this->getHealth();
// $this->dataPacket($pk);
//// }
$this->foodTick = 0;
$this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
}
}
示例6: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$pk = new UpdateAttributesPacket();
$this->foodTick = 0;
$pk->minValue = 0;
$pk->maxValue = $this->getMaxHealth();
$pk->value = $amount;
$pk->name = UpdateAttributesPacket::HEALTH;
$this->dataPacket($pk);
}
}
示例7: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
$pk = new SetHealthPacket();
$pk->health = $this->getHealth();
$this->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
}
}
示例8: setHealth
public function setHealth($amount)
{
parent::setHealth($amount);
if ($this->spawned === true) {
#$this->health = $amount;
$this->getAttributeMap()->getAttribute(Attribute::HEALTH)->setMaxValue($this->getMaxHealth())->setValue($amount, false);
//maybe setmax causes doublehit
//Client hack: (Client always shows hit animation on SetHealthPacket) (Now its there because of /kill)
if (!$this->isAlive()) {
$pk = new SetHealthPacket();
$pk->health = $this->getHealth();
$this->dataPacket($pk);
}
$this->foodTickTimer = 0;
}
}