當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tile::createTile方法代碼示例

本文整理匯總了PHP中pocketmine\tile\Tile::createTile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tile::createTile方法的具體用法?PHP Tile::createTile怎麽用?PHP Tile::createTile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\tile\Tile的用法示例。


在下文中一共展示了Tile::createTile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $t = $this->getLevel()->getTile($this);
         if ($t instanceof FurnaceTile) {
             $furnace = $t;
         } else {
             $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::FURNACE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
             $nbt->Items->setTagType(NBT::TAG_Compound);
             $furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         }
         if (isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag) {
             if ($furnace->namedtag->Lock->getValue() !== $item->getCustomName()) {
                 return true;
             }
         }
         if ($player->isCreative() and $player->getServer()->limitedCreative) {
             return true;
         }
         $player->addWindow($furnace->getInventory());
     }
     return true;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:23,代碼來源:Furnace.php

示例2: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if (!$this->getLevel()->getServer()->enchantingTableEnabled) {
         return true;
     }
     if ($player instanceof Player) {
         if ($player->isCreative() and $player->getServer()->limitedCreative) {
             return true;
         }
         $tile = $this->getLevel()->getTile($this);
         $enchantTable = null;
         if ($tile instanceof EnchantTable) {
             $enchantTable = $tile;
         } else {
             $this->getLevel()->setBlock($this, $this, true, true);
             $nbt = new CompoundTag("", [new StringTag("id", Tile::ENCHANT_TABLE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
             if ($item->hasCustomName()) {
                 $nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
             }
             if ($item->hasCustomBlockData()) {
                 foreach ($item->getCustomBlockData() as $key => $v) {
                     $nbt->{$key} = $v;
                 }
             }
             /** @var EnchantTable $enchantTable */
             $enchantTable = Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         }
         $player->addWindow(new EnchantInventory($this));
         $player->craftingType = Player::CRAFTING_ENCHANT;
     }
     return true;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:32,代碼來源:EnchantingTable.php

示例3: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $top = $this->getSide(1);
         if ($top->isTransparent() !== true) {
             return true;
         }
         $t = $this->getLevel()->getTile($this);
         $chest = null;
         if ($t instanceof TileChest) {
             $chest = $t;
         } else {
             $nbt = new CompoundTag("", [new EnumTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
             $nbt->Items->setTagType(NBT::TAG_Compound);
             $chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         }
         if (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag) {
             if ($chest->namedtag->Lock->getValue() !== $item->getCustomName()) {
                 return true;
             }
         }
         if ($player->isCreative() and $player->getServer()->limitedCreative) {
             return true;
         }
         $player->addWindow($chest->getInventory());
     }
     return true;
 }
開發者ID:xpyctum,項目名稱:Genisys,代碼行數:28,代碼來源:Chest.php

示例4: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $top = $this->getSide(1);
         if ($top->isTransparent() !== true) {
             return true;
         }
         $this->BroadcastRedstoneUpdate(Level::REDSTONE_UPDATE_PLACE, Block::REDSTONESOURCEPOWER);
         $this->getLevel()->scheduleUpdate($this, 2);
         $t = $this->getLevel()->getTile($this);
         $chest = null;
         if ($t instanceof TileChest) {
             $chest = $t;
         } else {
             $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
             $nbt->Items->setTagType(NBT::TAG_Compound);
             $chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         }
         if (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag) {
             if ($chest->namedtag->Lock->getValue() !== $item->getCustomName()) {
                 return true;
             }
         }
         $player->addWindow($chest->getInventory());
     }
     return true;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:27,代碼來源:TrappedChest.php

示例5: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $this->getLevel()->setBlock($this, $this, true, true);
     $nbt = new CompoundTag("", [new StringTag("id", MainClass::TILE_NOTE), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new ByteTag("note", 0)]);
     $pot = Tile::createTile("Note", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
開發者ID:beito123,項目名稱:PocketMine-MP-Plugins,代碼行數:7,代碼來源:BlockNote.php

示例6: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($face !== 0) {
         $nbt = new CompoundTag("", ["id" => new StringTag("id", Tile::SIGN), "x" => new IntTag("x", $block->x), "y" => new IntTag("y", $block->y), "z" => new IntTag("z", $block->z), "Text1" => new StringTag("Text1", ""), "Text2" => new StringTag("Text2", ""), "Text3" => new StringTag("Text3", ""), "Text4" => new StringTag("Text4", "")]);
         if ($player !== null) {
             $nbt->Creator = new StringTag("Creator", $player->getRawUniqueId());
         }
         if ($item->hasCustomBlockData()) {
             foreach ($item->getCustomBlockData() as $key => $v) {
                 $nbt->{$key} = $v;
             }
         }
         if ($face === 1) {
             $this->meta = floor(($player->yaw + 180) * 16 / 360 + 0.5) & 0xf;
             $this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true);
             Tile::createTile(Tile::SIGN, $this->getLevel()->getChunk($block->x >> 4, $block->z >> 4), $nbt);
             return true;
         } else {
             $this->meta = $face;
             $this->getLevel()->setBlock($block, Block::get(Item::WALL_SIGN, $this->meta), true);
             Tile::createTile(Tile::SIGN, $this->getLevel()->getChunk($block->x >> 4, $block->z >> 4), $nbt);
             return true;
         }
     }
     return false;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:26,代碼來源:SignPost.php

示例7: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new StringTag("id", Tile::MOB_SPAWNER), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new IntTag("EntityId", 0)]);
     Tile::createTile(Tile::MOB_SPAWNER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
開發者ID:MrDoni98,項目名稱:Genisys,代碼行數:7,代碼來源:MonsterSpawner.php

示例8: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $this->getLevel()->setBlock($block, $this, true, false);
     $nbt = new CompoundTag("", [new StringTag("id", Tile::DAY_LIGHT_DETECTOR), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
     Tile::createTile(Tile::DAY_LIGHT_DETECTOR, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:7,代碼來源:DaylightDetector.php

示例9: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $nbt = new CompoundTag("", [new StringTag("id", MainClass::TILE_CAULDRON), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new ShortTag("PotionId", 0xffff), new ByteTag("SplashPotion", 0), new ListTag("Items", [])]);
     $chunk = $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4);
     $tile = Tile::createTile("Cauldron", $chunk, $nbt);
     //
     $this->getLevel()->setBlock($block, $this, true, true);
     return true;
 }
開發者ID:beito123,項目名稱:PocketMine-MP-Plugins,代碼行數:9,代碼來源:BlockCauldron.php

示例10: getTile

 /**
  * @return DLDetector
  */
 protected function getTile()
 {
     $t = $this->getLevel()->getTile($this);
     if ($t instanceof DLDetector) {
         return $t;
     } else {
         $nbt = new CompoundTag("", [new StringTag("id", Tile::DAY_LIGHT_DETECTOR), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
         return Tile::createTile(Tile::DAY_LIGHT_DETECTOR, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:13,代碼來源:DaylightDetector.php

示例11: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === false) {
         $this->getLevel()->setBlock($block, $this, true, true);
         $nbt = new Compound("", [new String("id", Tile::FLOWER_POT), new Int("x", $block->x), new Int("y", $block->y), new Int("z", $block->z), new Int("item", 0), new Int("data", 0)]);
         $pot = Tile::createTile("FlowerPot", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         return true;
     }
     return false;
 }
開發者ID:abc12309874,項目名稱:Genisys,代碼行數:10,代碼來源:FlowerPot.php

示例12: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $down = $block->getSide(0);
     if ($down->isTransparent() === false || $down instanceof Slab && ($down->meta & 0x8) === 0x8 || $down instanceof WoodSlab && ($down->meta & 0x8) === 0x8 || $down instanceof Stair && ($down->meta & 0x4) === 0x4) {
         $this->getLevel()->setBlock($block, $this, true, true);
         $nbt = new Compound("", [new String("id", Tile::FLOWER_POT), new Int("x", $block->x), new Int("y", $block->y), new Int("z", $block->z), new Short("item", 0), new Int("mData", 0)]);
         $pot = Tile::createTile("FlowerPot", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         return true;
     }
     return false;
 }
開發者ID:kakichi,項目名稱:ClearSky,代碼行數:11,代碼來源:FlowerPot.php

示例13: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($face !== 0) {
         $this->getLevel()->setBlock($block, Block::get(MainClass::BLOCK_SKULL, 0), true, true);
         $nbt = new Compound("", [new String("id", Tile::SKULL), new Int("x", $block->x), new Int("y", $block->y), new Int("z", $block->z), new Byte("SkullType", $item->getDamage()), new Byte("Rot", floor($player->yaw * 16 / 360 + 0.5) & 0xf)]);
         $chunk = $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4);
         $pot = Tile::createTile("Skull", $chunk, $nbt);
         $this->getLevel()->setBlock($block, Block::get(MainClass::BLOCK_SKULL, $face), true, true);
         return true;
     }
     return false;
 }
開發者ID:thebigsmileXD,項目名稱:PocketMine-MP-Plugins,代碼行數:12,代碼來源:BlockSkull.php

示例14: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new StringTag("id", Tile::MOB_SPAWNER), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new IntTag("EntityId", 0)]);
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     Tile::createTile(Tile::MOB_SPAWNER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:12,代碼來源:MonsterSpawner.php

示例15: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $nbt = new CompoundTag("", [new StringTag("id", Tile::CAULDRON), new IntTag("x", $block->x), new IntTag("y", $block->y), new IntTag("z", $block->z), new ShortTag("PotionId", 0xffff), new ByteTag("SplashPotion", 0), new ListTag("Items", [])]);
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     $chunk = $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4);
     $tile = Tile::createTile("Cauldron", $chunk, $nbt);
     $this->getLevel()->setBlock($block, $this, true, true);
     return true;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:13,代碼來源:Cauldron.php


注:本文中的pocketmine\tile\Tile::createTile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。