本文整理汇总了PHP中BukkitPE\item\Item类的典型用法代码示例。如果您正苦于以下问题:PHP Item类的具体用法?PHP Item怎么用?PHP Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe()) {
return [$this->id, 0, 1];
}
return [];
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:7,代码来源:LightWeightedPressurePlate.php
示例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;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:25,代码来源:Sugarcane.php
示例3: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_STONE) {
return [[Item::DYE, 4, mt_rand(4, 8)]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:LapisOre.php
示例4: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_DIAMOND) {
return [[Item::OBSIDIAN, 0, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:Obsidian.php
示例5: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::SLAB, $this->meta & 0x7, 2]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:DoubleSlab.php
示例6: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[$this->id, $this->meta, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:NetherBrickFence.php
示例7: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::QUARTZ_BLOCK, $this->meta & 0x3, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:Quartz.php
示例8: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::STONE_BRICKS, $this->meta & 0x3, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:StoneBricks.php
示例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 [];
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:SnowLayer.php
示例10: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_STONE) {
return [[Item::LAPIS_BLOCK, 0, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:Lapis.php
示例11: getDrops
public function getDrops(Item $item)
{
$drops = [];
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
$drops[] = [Item::BREWING_STAND, 0, 1];
}
return $drops;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:BrewingStand.php
示例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 [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:Stone.php
示例13: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_IRON) {
return [[Item::GOLD_ORE, 0, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:GoldOre.php
示例14: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_GOLD) {
return [[Item::REDSTONE_DUST, 0, mt_rand(4, 5)]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:RedstoneOre.php
示例15: getDrops
public function getDrops(Item $item)
{
if ($item->isPickaxe() >= Tool::TIER_WOODEN) {
return [[Item::COAL, 0, 1]];
} else {
return [];
}
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:8,代码来源:CoalOre.php
示例16: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($item->isHoe()) {
$item->useOn($this);
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true);
return true;
}
return false;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:9,代码来源:Dirt.php
示例17: getDrops
public function getDrops(Item $item)
{
if ($item->isShears()) {
return [$this->id, $this->meta, 1];
} elseif (mt_rand(0, 15) === 0) {
return [Item::WHEAT_SEEDS, 0, 1];
}
return [];
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:9,代码来源:TallGrass.php
示例18: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($item->getId() === Item::FLINT_STEEL) {
$item->useOn($this);
$this->getLevel()->setBlock($this, new Air(), true);
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
$tnt = Entity::createEntity("PrimedTNT", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", ["Pos" => new Enum("Pos", [new Double("", $this->x + 0.5), new Double("", $this->y), new Double("", $this->z + 0.5)]), "Motion" => new Enum("Motion", [new Double("", -sin($mot) * 0.02), new Double("", 0.2), new Double("", -cos($mot) * 0.02)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Fuse" => new Byte("Fuse", 80)]));
$tnt->spawnToAll();
return true;
}
return false;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:12,代码来源:TNT.php
示例19: removeIngredient
/**
* @param Item $item
*
* @return $this
*/
public function removeIngredient(Item $item)
{
foreach ($this->ingredients as $index => $ingredient) {
if ($item->getCount() <= 0) {
break;
}
if ($ingredient->equals($item, $item->getDamage() === null ? false : true, $item->getCompoundTag() === null ? false : true)) {
unset($this->ingredients[$index]);
$item->setCount($item->getCount() - 1);
}
}
return $this;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:18,代码来源:ShapelessRecipe.php
示例20: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($item->getId() === Item::DYE and $item->getDamage() === 0xf) {
//Bonemeal
//TODO: change log type
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x7);
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
return true;
}
return false;
}
开发者ID:MunkySkunk,项目名称:BukkitPE,代码行数:13,代码来源:Sapling.php
注:本文中的BukkitPE\item\Item类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论