本文整理汇总了PHP中BukkitPE\item\Item::getCustomName方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getCustomName方法的具体用法?PHP Item::getCustomName怎么用?PHP Item::getCustomName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BukkitPE\item\Item
的用法示例。
在下文中一共展示了Item::getCustomName方法的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;
}
示例2: 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;
}
示例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 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);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof String) {
if ($chest->namedtag->Lock->getValue() !== $item->getCustomName()) {
return true;
}
}
if ($player->isCreative()) {
return true;
}
$player->addWindow($chest->getInventory());
}
return true;
}
示例4: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$t = $this->getLevel()->getTile($this);
$furnace = false;
if ($t instanceof Furnace) {
$furnace = $t;
} else {
$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);
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if (isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof String) {
if ($furnace->namedtag->Lock->getValue() !== $item->getCustomName()) {
return true;
}
}
if ($player->isCreative()) {
return true;
}
$player->addWindow($furnace->getInventory());
}
return true;
}