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


PHP Item::hasCustomBlockData方法代码示例

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


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

示例1: 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:MunkySkunk,项目名称:BukkitPE,代码行数:15,代码来源:EnchantingTable.php

示例2: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $faces = [0 => 4, 1 => 2, 2 => 5, 3 => 3];
     $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new String("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:gitter-badger,项目名称:BukkitPE,代码行数:18,代码来源:BurningFurnace.php

示例3: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($block->getSide(Vector3::SIDE_DOWN)->isTransparent() === false) {
         $this->getLevel()->setBlock($block, $this, true, true);
         $nbt = new Compound("", [new String("id", Tile::BREWING_STAND), 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::BREWING_STAND, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         return true;
     }
     return false;
 }
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:18,代码来源:BrewingStand.php

示例4: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $faces = [0 => 4, 1 => 2, 2 => 5, 3 => 3];
     $chest = null;
     $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
     for ($side = 2; $side <= 5; ++$side) {
         if (($this->meta === 4 or $this->meta === 5) and ($side === 4 or $side === 5)) {
             continue;
         } elseif (($this->meta === 3 or $this->meta === 2) and ($side === 2 or $side === 3)) {
             continue;
         }
         $c = $this->getSide($side);
         if ($c instanceof Chest and $c->getDamage() === $this->meta) {
             $tile = $this->getLevel()->getTile($c);
             if ($tile instanceof TileChest and !$tile->isPaired()) {
                 $chest = $tile;
                 break;
             }
         }
     }
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new String("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     $tile = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     if ($chest instanceof TileChest and $tile instanceof TileChest) {
         $chest->pairWith($tile);
         $tile->pairWith($chest);
     }
     return true;
 }
开发者ID:gitter-badger,项目名称:BukkitPE,代码行数:38,代码来源:Chest.php


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