本文整理匯總了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 [];
}
}