本文整理汇总了PHP中pocketmine\entity\Entity::initEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::initEntity方法的具体用法?PHP Entity::initEntity怎么用?PHP Entity::initEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\entity\Entity
的用法示例。
在下文中一共展示了Entity::initEntity方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initEntity
protected function initEntity()
{
parent::initEntity();
$this->setMaxHealth(5);
$this->setHealth($this->namedtag["Health"]);
if (isset($this->namedtag->Age)) {
$this->age = $this->namedtag["Age"];
}
if (isset($this->namedtag->PickupDelay)) {
$this->pickupDelay = $this->namedtag["PickupDelay"];
}
if (isset($this->namedtag->Owner)) {
$this->owner = $this->namedtag["Owner"];
}
if (isset($this->namedtag->Thrower)) {
$this->thrower = $this->namedtag["Thrower"];
}
if (!isset($this->namedtag->Item)) {
$this->close();
return;
}
assert($this->namedtag->Item instanceof CompoundTag);
$this->item = NBT::getItemHelper($this->namedtag->Item);
$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
}
示例2: initEntity
protected function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->remove)) {
//flag check
$this->kill();
}
}
示例3: initEntity
public function initEntity()
{
if (isset($this->namedtag->Movement)) {
$this->setMovement($this->namedtag["Movement"]);
}
$this->dataProperties[self::DATA_NO_AI] = [self::DATA_TYPE_BYTE, 1];
Entity::initEntity();
}
示例4: initEntity
public function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->Experience)) {
$this->experience = $this->namedtag["Experience"];
} else {
$this->close();
}
}
示例5: initEntity
protected function initEntity()
{
parent::initEntity();
$this->setMaxHealth(1);
$this->setHealth(1);
if (isset($this->namedtag->Age)) {
$this->age = $this->namedtag["Age"];
}
}
示例6: initEntity
protected function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->Fuse)) {
$this->fuse = $this->namedtag["Fuse"];
} else {
$this->fuse = 80;
}
}
示例7: initEntity
protected function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->HealF)) {
$this->namedtag->Health = new ShortTag("Health", (int) $this->namedtag["HealF"]);
unset($this->namedtag->HealF);
} elseif (!isset($this->namedtag->Health) or !$this->namedtag->Health instanceof ShortTag) {
$this->namedtag->Health = new ShortTag("Health", $this->getMaxHealth());
}
$this->setHealth($this->namedtag["Health"]);
}
示例8: initEntity
protected function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->HealF)) {
$this->namedtag->Health = new ShortTag("Health", (int) $this->namedtag["HealF"]);
unset($this->namedtag->HealF);
} elseif (!isset($this->namedtag->Health) or !$this->namedtag->Health instanceof ShortTag) {
$this->namedtag->Health = new ShortTag("Health", $this->getMaxHealth());
}
if (!isset($this->namedtag->MaxHealth) or !$this->namedtag->MaxHealth instanceof ShortTag) {
$this->namedtag->MaxHealth = new ShortTag("MaxHealth", $this->getMaxHealth());
}
$this->setMaxHealth($this->namedtag["MaxHealth"]);
$this->setHealth($this->getAttributeMap()->getAttribute(Attribute::HEALTH)->setMaxValue($this->getMaxHealth())->setValue($this->namedtag["Health"]));
}
示例9: initEntity
protected function initEntity()
{
parent::initEntity();
if (isset($this->namedtag->TileID)) {
$this->blockId = $this->namedtag["TileID"];
} elseif (isset($this->namedtag->Tile)) {
$this->blockId = $this->namedtag["Tile"];
$this->namedtag["TileID"] = new Int("TileID", $this->blockId);
}
if (isset($this->namedtag->Data)) {
$this->damage = $this->namedtag["Data"];
}
if ($this->blockId === 0) {
$this->close();
return;
}
$this->setDataProperty(self::DATA_BLOCK_INFO, self::DATA_TYPE_INT, $this->getBlock() | $this->getDamage() << 8);
}
示例10: initEntity
protected function initEntity()
{
parent::initEntity();
$this->setMaxHealth(5);
$this->setHealth($this->namedtag["Health"]);
if (isset($this->namedtag->Age)) {
$this->age = $this->namedtag["Age"];
}
if (isset($this->namedtag->PickupDelay)) {
$this->pickupDelay = $this->namedtag["PickupDelay"];
}
if (isset($this->namedtag->Owner)) {
$this->owner = $this->namedtag["Owner"];
}
if (isset($this->namedtag->Thrower)) {
$this->thrower = $this->namedtag["Thrower"];
}
$this->item = ItemItem::get($this->namedtag->Item["id"], $this->namedtag->Item["Damage"], $this->namedtag->Item["Count"]);
$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
}
示例11: initEntity
public function initEntity()
{
$this->setMaxHealth(1);
parent::initEntity();
}
示例12: initEntity
public function initEntity()
{
parent::initEntity();
}
示例13: initEntity
public function initEntity()
{
if (isset($this->namedtag->Movement)) {
$this->setMovement($this->namedtag["Movement"]);
}
$this->dataProperties = [self::DATA_FLAGS => [self::DATA_TYPE_BYTE, 0], self::DATA_AIR => [self::DATA_TYPE_SHORT, 300], self::DATA_NAMETAG => [self::DATA_TYPE_STRING, ""], self::DATA_SHOW_NAMETAG => [self::DATA_TYPE_BYTE, 1], self::DATA_SILENT => [self::DATA_TYPE_BYTE, 0], self::DATA_NO_AI => [self::DATA_TYPE_BYTE, 0]];
Entity::initEntity();
}