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


PHP entity\Human类代码示例

本文整理汇总了PHP中pocketmine\entity\Human的典型用法代码示例。如果您正苦于以下问题:PHP Human类的具体用法?PHP Human怎么用?PHP Human使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * @param Vector3 $v
  * @param mixed $data
  * @param int $id
  * @param FullChunk $chunk
  */
 public function __construct($v, $data, $id = -2, $chunk = null)
 {
     $this->data = $data;
     if (!$v instanceof Vector3) {
         if ($v instanceof FullChunk) {
             $v->removeEntity($this);
         }
         throw new \RuntimeException("BadConstructCustomHuman");
     }
     $nbt = new Compound();
     $nbt->Pos = new Enum("Motion", [new Double(0, $v->x), new Double(1, $v->y), new Double(2, $v->z)]);
     $nbt->Motion = new Enum("Motion", [new Double(0, 0), new Double(1, 0), new Double(2, 0)]);
     $nbt->Rotation = new Enum("Rotation", [new Float(0, $this->getDefaultYaw()), new Float(1, $this->getDefaultPitch())]);
     $nbt->FallDistance = new Float("FallDistance", 0);
     $nbt->Fire = new Short("Fire", 0);
     $nbt->Air = new Short("Air", 0);
     $nbt->OnGround = new Byte("OnGround", 1);
     $nbt->Invulnerable = new Byte("Invulnerable", 1);
     $nbt->Health = new Short("Health", 20);
     $nbt->NameTag = $this->getDefaultName();
     $nbt->Inventory = new Enum("Inventory", []);
     $nbt->Inventory->setTagType(NBT::TAG_Compound);
     $this->inventory = new PlayerInventory($this);
     $this->setSkin($this->getDefaultSkin());
     parent::__construct($chunk, $nbt);
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:32,代码来源:CustomHuman.php

示例2: setExp

 public function setExp($exp)
 {
     $this->progress = $exp / Human::getLevelXpRequirement($this->level);
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:4,代码来源:PlayerExperienceChangeEvent.php

示例3: loadSkin

 /**
  * Load skin
  * @param Human $human
  * @param bool $slim
  * @param str $fn
  * @return bool
  */
 public static function loadSkin(Human $human, $slim, $fn)
 {
     if (self::isPngExt($fn)) {
         if (!extension_loaded("gd")) {
             return false;
         }
         if (!self::isSkinFile($fn)) {
             return false;
         }
         $img = imagecreatefrompng($fn);
         if ($img === false) {
             return false;
         }
         $bytes = "";
         $x = $y = 0;
         while ($y < 32) {
             $rgb = imagecolorat($img, $x, $y);
             $r = $rgb >> 16 & 0xff;
             $g = $rgb >> 8 & 0xff;
             $b = $rgb & 0xff;
             $bytes .= chr($r) . chr($g) . chr($b) . chr(255);
             $x++;
             if ($x === 64) {
                 $x = 0;
                 $y++;
             }
         }
         imagedestroy($img);
         echo "BYTES=" . strlen($bytes) . "\n";
         //##DEBUG
         $human->setSkin($bytes, $slim);
         return true;
     }
     $bin = file_get_contents($fn);
     if ($bin === false) {
         return false;
     }
     $human->setSkin(zlib_decode($bin), $slim);
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:47,代码来源:SkinUtils.php

示例4: toFile

 /**
  * Creates a new file containing skin data
  * @param Human $human
  */
 public static function toFile(Human $human)
 {
     @mkdir(SkinTools::getInstance()->getDataFolder() . "data/");
     file_put_contents(SkinTools::getInstance()->getDataFolder() . "data/" . strtolower($human->getName()) . ".dat", self::compress($human->getSkinData()));
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:9,代码来源:SkinConverter.php

示例5: teleportImmediate

 /**
  * This method may not be reliable. Clients don't like to be moved into unloaded chunks.
  * Use teleport() for a delayed teleport after chunks have been sent.
  *
  * @param Vector3 $pos
  * @param float   $yaw
  * @param float   $pitch
  */
 public function teleportImmediate(Vector3 $pos, $yaw = null, $pitch = null)
 {
     if (parent::teleport($pos, $yaw, $pitch)) {
         foreach ($this->windowIndex as $window) {
             if ($window === $this->inventory) {
                 continue;
             }
             $this->removeWindow($window);
         }
         $this->forceMovement = new Vector3($this->x, $this->y, $this->z);
         $this->sendPosition($this, $this->yaw, $this->pitch, 1);
         $this->resetFallDistance();
         $this->orderChunks();
         $this->nextChunkOrderRun = 0;
         $this->newPosition = null;
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:25,代码来源:Player.php

示例6: teleport

 public function teleport(Vector3 $pos, $yaw = null, $pitch = null)
 {
     if (parent::teleport($pos, $yaw, $pitch)) {
         foreach ($this->windowIndex as $window) {
             if ($window === $this->inventory) {
                 continue;
             }
             $this->removeWindow($window);
         }
         $this->airTicks = 300;
         $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 300);
         $pk = new MovePlayerPacket();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y + $this->getEyeHeight();
         $pk->z = $this->z;
         $pk->bodyYaw = 0;
         $pk->pitch = $this->pitch;
         $pk->yaw = $this->yaw;
         $pk->mode = 1;
         $pk->teleport = 1;
         $this->directDataPacket($pk);
         $this->resetFallDistance();
         $this->orderChunks();
         $this->nextChunkOrderRun = 0;
         $this->forceMovement = new Vector3($this->x, $this->y, $this->z);
         $this->newPosition = null;
     }
 }
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:29,代码来源:Player.php

示例7: kill

 public function kill()
 {
     parent::kill();
     $this->poofAway();
 }
开发者ID:mwvent,项目名称:WattzMCPE,代码行数:5,代码来源:UndeadPlayer.php

示例8: knockBack

 public function knockBack(Entity $attacker, $damage, $x, $z, $base = 0.4)
 {
     $this->knockback = time() + 1;
     // Stunned for 1 second...
     parent::knockBack($attacker, $damage, 0.1, 0.1, 0.1);
 }
开发者ID:mwvent,项目名称:WattzMCPE,代码行数:6,代码来源:Herobrine.php

示例9: teleport

 public function teleport(Vector3 $pos, $yaw = null, $pitch = null)
 {
     if (!$this->isOnline()) {
         return;
     }
     $oldPos = $this->getPosition();
     if (parent::teleport($pos, $yaw, $pitch)) {
         foreach ($this->windowIndex as $window) {
             if ($window === $this->inventory) {
                 continue;
             }
             $this->removeWindow($window);
         }
         $this->teleportPosition = new Vector3($this->x, $this->y, $this->z);
         if (!$this->checkTeleportPosition()) {
             $this->forceMovement = $oldPos;
         } else {
             $this->spawnToAll();
         }
         $this->resetFallDistance();
         $this->nextChunkOrderRun = 0;
         $this->newPosition = null;
     }
 }
开发者ID:WonderlandPE,项目名称:Steadfast2,代码行数:24,代码来源:Player.php

示例10: spawnTo

 public function spawnTo(Player $player)
 {
     parent::spawnTo($player);
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:4,代码来源:HealBed.php

示例11: teleport

 public function teleport(Vector3 $pos, $yaw = null, $pitch = null)
 {
     if (parent::teleport($pos, $yaw, $pitch)) {
         $this->airTicks = 300;
         $this->fallDistance = 0;
         $this->orderChunks();
         $this->chunkLoadTask->setNextRun(0);
         $this->forceMovement = $pos;
         $pk = new MovePlayerPacket();
         $pk->eid = 0;
         $pk->x = $this->x;
         $pk->y = $this->y + $this->getEyeHeight();
         $pk->z = $this->z;
         $pk->bodyYaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->yaw = $this->yaw;
         $pk->teleport = true;
         $this->directDataPacket($pk);
     }
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:20,代码来源:Player.php

示例12: addEffect

 /**
  * @param Effect
  */
 public function addEffect(Effect $effect)
 {
     //Overwrite
     if ($effect->isBad() && $this->isCreative()) {
         return;
     }
     parent::addEffect($effect);
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:11,代码来源:Player.php


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