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


PHP tile\Tile类代码示例

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


在下文中一共展示了Tile类的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: isBadSign

 /**
  * @param Tile $tile
  * @return bool
  */
 public function isBadSign(Tile $tile)
 {
     if ($tile instanceof Sign) {
         $text = "";
         foreach ($tile->getText() as $line) {
             $text .= strtolower(trim($line));
         }
     }
 }
开发者ID:Evarettedavis,项目名称:PocketMine-Plugins,代码行数:13,代码来源:GlobalShield.php

示例3: 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

示例4: 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

示例5: 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

示例6: onEnable

 public function onEnable()
 {
     //アイテムの追加
     Item::$list[self::ITEM_FLOWER_POT] = ItemFlowerPot::class;
     //ブロックの追加
     $this->registerBlock(self::BLOCK_FLOWER_POT, BlockFlowerPot::class);
     //ブロックタイルエンティティの追加
     Tile::registerTile(FlowerPot::class);
     //アイテムをクリエイティブタブに追加
     Item::addCreativeItem(Item::get(self::ITEM_FLOWER_POT, 0));
     //一応レシピ追加
     Server::getInstance()->getCraftingManager()->registerRecipe((new ShapedRecipe(Item::get(MainClass::ITEM_FLOWER_POT, 0, 1), "X X", " X "))->setIngredient("X", Item::get(Item::BRICK, null)));
     //omake skull
     //アイテムの追加
     Item::$list[self::ITEM_SKULL] = ItemSkull::class;
     //ブロックの追加
     $this->registerBlock(self::BLOCK_SKULL, BlockSkull::class);
     //ブロックタイルエンティティの追加
     Tile::registerTile(Skull::class);
     //アイテムをクリエイティブタブに追加
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 0));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 1));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 2));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 3));
     Item::addCreativeItem(Item::get(self::ITEM_SKULL, 4));
 }
开发者ID:MrDoni98,项目名称:PocketMine-MP-Plugins,代码行数:26,代码来源:MainClass.php

示例7: 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

示例8: 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

示例9: 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

示例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)
 {
     $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

示例12: 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

示例13: 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

示例14: 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

示例15: 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 Compound("", [new String("id", Tile::ENCHANT_TABLE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new String("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:robozeri,项目名称:Yuriko-MP,代码行数:15,代码来源:EnchantingTable.php


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