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


PHP Item::getCustomName方法代码示例

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


在下文中一共展示了Item::getCustomName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ($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

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

示例4: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $dispenser = null;
     if ($player instanceof Player) {
         $pitch = $player->getPitch();
         if (abs($pitch) >= 45) {
             if ($pitch < 0) {
                 $f = 4;
             } else {
                 $f = 5;
             }
         } else {
             $f = $player->getDirection();
         }
     } else {
         $f = 0;
     }
     $faces = [3 => 3, 0 => 4, 2 => 5, 1 => 2, 4 => 0, 5 => 1];
     $this->meta = $faces[$f];
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::DISPENSER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     Tile::createTile(Tile::DISPENSER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:33,代码来源:Dispenser.php

示例5: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $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:ClearSkyTeam,项目名称:ClearSky,代码行数:26,代码来源:EnchantingTable.php

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

示例7: 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:orlando092,项目名称:ImagicalMine,代码行数:18,代码来源:BrewingStand.php

示例8: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $faces = [0 => 0, 1 => 0, 2 => 3, 3 => 2, 4 => 5, 5 => 4];
     $this->meta = $faces[$face];
     $this->getLevel()->setBlock($block, $this, true, true);
     $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::HOPPER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
     $nbt->Items->setTagType(NBT::TAG_Compound);
     if ($item->hasCustomName()) {
         $nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
     }
     if ($item->hasCustomBlockData()) {
         foreach ($item->getCustomBlockData() as $key => $v) {
             $nbt->{$key} = $v;
         }
     }
     $t = Tile::createTile(Tile::HOPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     return true;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:18,代码来源:Hopper.php

示例9: place

 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     if ($face !== 0) {
         $this->meta = $face;
         if ($face === 1) {
             $rot = floor($player->yaw * 16 / 360 + 0.5) & 0xf;
         } else {
             $rot = $face;
         }
         $this->getLevel()->setBlock($block, $this, true);
         $nbt = new CompoundTag("", [new StringTag("id", Tile::SKULL), new ByteTag("SkullType", $item->getDamage()), new ByteTag("Rot", $rot), new IntTag("x", (int) $this->x), new IntTag("y", (int) $this->y), new IntTag("z", (int) $this->z)]);
         if ($item->hasCustomName()) {
             $nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
         }
         /** @var Spawnable $tile */
         Tile::createTile("Skull", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         return true;
     }
     return false;
 }
开发者ID:Tinclon,项目名称:PocketMine-MP,代码行数:20,代码来源:MobHead.php

示例10: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($player instanceof Player) {
         $t = $this->getLevel()->getTile($this);
         $hopper = null;
         if ($t instanceof HopperTile) {
             $hopper = $t;
         } else {
             $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::HOPPER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
             $nbt->Items->setTagType(NBT::TAG_Compound);
             $hopper = Tile::createTile(Tile::HOPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
         }
         if (isset($hopper->namedtag->Lock) and $hopper->namedtag->Lock instanceof StringTag) {
             if ($hopper->namedtag->Lock->getValue() !== $item->getCustomName()) {
                 return true;
             }
         }
         $player->addWindow($hopper->getInventory());
     }
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:21,代码来源:Hopper.php

示例11: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if (!$this->getLevel()->getServer()->enchantingTableEnabled) {
         return true;
     }
     if ($player instanceof Player) {
         //TODO lock
         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;
             }
         }
         $enchantTable = Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     }
     $player->addWindow($enchantTable->getInventory());
     return true;
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:31,代码来源:EnchantingTable.php


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