本文整理汇总了PHP中BukkitPE\item\Item类的典型用法代码示例。如果您正苦于以下问题:PHP Item类的具体用法?PHP Item怎么用?PHP Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe()) {
return [$this->id, 0, 1];
}
return [];
}
示例2: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($item->getId() === Item::DYE and $item->getDamage() === 0xf) {
//Bonemeal
if ($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK) {
for ($y = 1; $y < 3; ++$y) {
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if ($b->getId() === self::AIR) {
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane()));
if (!$ev->isCancelled()) {
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
}
break;
}
}
$this->meta = 0;
$this->getLevel()->setBlock($this, $this, true);
}
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
return true;
}
return false;
}
示例3: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_STONE) {
return [[Item::DYE, 4, mt_rand(4, 8)]];
} else {
return [];
}
}
示例4: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_DIAMOND) {
return [[Item::OBSIDIAN, 0, 1]];
} else {
return [];
}
}
示例5: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::SLAB, $this->meta & 0x7, 2]];
} else {
return [];
}
}
示例6: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[$this->id, $this->meta, 1]];
} else {
return [];
}
}
示例7: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::QUARTZ_BLOCK, $this->meta & 0x3, 1]];
} else {
return [];
}
}
示例8: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::STONE_BRICKS, $this->meta & 0x3, 1]];
} else {
return [];
}
}
示例9: getDrops
public function getDrops(Item $item)
{
if ($item->isShovel() !== false) {
return [[Item::SNOWBALL, 0, $this->getDamage() + 1]];
// Amount in PC version is based on the number of layers
}
return [];
}
示例10: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_STONE) {
return [[Item::LAPIS_BLOCK, 0, 1]];
} else {
return [];
}
}
示例11: getDrops
public function getDrops(Item $item)
{
$drops = [];
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
$drops[] = [Item::BREWING_STAND, 0, 1];
}
return $drops;
}
示例12: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[$this->getDamage() === 0 ? Item::COBBLESTONE : Item::STONE, $this->getDamage(), 1]];
} else {
return [];
}
}
示例13: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_IRON) {
return [[Item::GOLD_ORE, 0, 1]];
} else {
return [];
}
}
示例14: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_GOLD) {
return [[Item::REDSTONE_DUST, 0, mt_rand(4, 5)]];
} else {
return [];
}
}
示例15: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::COAL, 0, 1]];
} else {
return [];
}
}