当前位置: 首页>>代码示例>>PHP>>正文


PHP Animal::__construct方法代码示例

本文整理汇总了PHP中pocketmine\entity\Animal::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Animal::__construct方法的具体用法?PHP Animal::__construct怎么用?PHP Animal::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\entity\Animal的用法示例。


在下文中一共展示了Animal::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     if (!isset($nbt->RabbitType)) {
         $nbt->RabbitType = new ByteTag("RabbitType", $this->getRandomRabbitType());
     }
     parent::__construct($chunk, $nbt);
     $this->setDataProperty(self::DATA_RABBIT_TYPE, self::DATA_TYPE_BYTE, $this->getRabbitType());
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:8,代码来源:Rabbit.php

示例2: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     if (!isset($nbt->CatType)) {
         $nbt->CatType = new ByteTag("CatType", mt_rand(0, 3));
     }
     parent::__construct($chunk, $nbt);
     $this->setDataProperty(self::DATA_CAT_TYPE, self::DATA_TYPE_BYTE, $this->getCatType());
 }
开发者ID:yungtechboy1,项目名称:Genisys,代码行数:8,代码来源:Ocelot.php

示例3: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     if (!isset($nbt->Color)) {
         $nbt->Color = new ByteTag("Color", self::getRandomColor());
     }
     parent::__construct($chunk, $nbt);
     $this->setDataProperty(self::DATA_COLOR_INFO, self::DATA_TYPE_BYTE, $this->getColor());
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:8,代码来源:Sheep.php

示例4: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt, PetOwner $petOwner)
 {
     // if $petOwner is null pocketmine is probably trying to reload a saved
     // version of this entity which we do not want anymore - as it is not cancellable ( I think ? )
     // just let it create and the update function will despawn the entity immediatley when it finds
     // it to have no targetPlayer
     if (is_null($petOwner)) {
         parent::__construct($chunk, $nbt);
         $this->close();
         return;
     }
     // TODO Catch error
     $this->petOwner = $petOwner;
     $this->petName_unformatted = $petOwner->petProperties->petName;
     $this->ownerName = $this->petOwner->player->getName();
     $this->petName = Main::translateColors("&", "&c[" . $this->ownerName . "] &f" . $this->petName_unformatted);
     $this->petType = $petOwner->petType;
     $location = $this->petOwner->player->getLocation();
     $nbt = new CompoundTag("", [new ListTag("Pos", [new DoubleTag("", $location->x), new DoubleTag("", $location->y), new DoubleTag("", $location->z)]), new ListTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), new ListTag("Rotation", [new FloatTag("", $location->yaw), new FloatTag("", $location->pitch)])]);
     $nbt->CustomName = new StringTag("CustomName", $this->petName);
     $nbt->CustomNameVisible = new ByteTag("CustomNameVisible", 1);
     $chunk = $location->getLevel()->getChunk($location->x >> 4, $location->z >> 4);
     $this->setNameTagVisible(true);
     parent::__construct($chunk, $nbt);
     $this->setNameTagVisible(true);
     $this->dataProperties = array_replace($this->dataProperties, $this->petType->meta);
     $this->spawnToAll();
     return true;
 }
开发者ID:flaxues,项目名称:BuddyPets,代码行数:29,代码来源:Pet.php


注:本文中的pocketmine\entity\Animal::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。