|
| __clone () |
|
| __toString () |
|
| canBePlaced () |
|
| canStackWith (Item $other) |
|
| clearCustomBlockData () |
|
| clearCustomName () |
|
| clearNamedTag () |
|
| equals (Item $item, bool $checkDamage=true, bool $checkCompound=true) |
|
| equalsExact (Item $other) |
|
| getAttackPoints () |
|
| getBlock (?int $clickedFace=null) |
|
| getBlockToolHarvestLevel () |
|
| getBlockToolType () |
|
| getCanDestroy () |
|
| getCanPlaceOn () |
|
| getCooldownTag () |
|
| getCooldownTicks () |
|
| getCount () |
|
| getCustomBlockData () |
|
| getCustomName () |
|
| getDefensePoints () |
|
| getEnchantability () |
|
| getEnchantmentTags () |
|
| getFuelResidue () |
|
| getFuelTime () |
|
| getLore () |
|
| getMaxStackSize () |
|
| getMiningEfficiency (bool $isCorrectTool) |
|
| getName () |
|
| getNamedTag () |
|
| getStateId () |
|
| getTypeId () |
|
| getVanillaName () |
|
| hasCustomBlockData () |
|
| hasCustomName () |
|
| hasNamedTag () |
|
| isFireProof () |
|
| isNull () |
|
| jsonSerialize () |
|
| keepOnDeath () |
|
| nbtSerialize (int $slot=-1) |
|
| onAttackEntity (Entity $victim, array &$returnedItems) |
|
| onClickAir (Player $player, Vector3 $directionVector, array &$returnedItems) |
|
| onDestroyBlock (Block $block, array &$returnedItems) |
|
| onInteractBlock (Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, array &$returnedItems) |
|
| onInteractEntity (Player $player, Entity $entity, Vector3 $clickVector) |
|
| onReleaseUsing (Player $player, array &$returnedItems) |
|
| onTickWorn (Living $entity) |
|
| pop (int $count=1) |
|
| setCanDestroy (array $canDestroy) |
|
| setCanPlaceOn (array $canPlaceOn) |
|
| setCount (int $count) |
|
| setCustomBlockData (CompoundTag $compound) |
|
| setCustomName (string $name) |
|
| setKeepOnDeath (bool $keepOnDeath) |
|
| setLore (array $lines) |
|
| setNamedTag (CompoundTag $tag) |
|
Definition at line 26 of file Book.php.
◆ __clone()
pocketmine\item\Item::__clone |
( |
| ) |
|
|
inherited |
◆ __toString()
pocketmine\item\Item::__toString |
( |
| ) |
|
|
finalinherited |
◆ canBePlaced()
pocketmine\item\Item::canBePlaced |
( |
| ) |
|
|
finalinherited |
◆ canStackWith()
pocketmine\item\Item::canStackWith |
( |
Item | $other | ) |
|
|
finalinherited |
Returns whether this item could stack with the given item (ignoring stack size and count).
Definition at line 685 of file Item.php.
◆ clearCustomBlockData()
pocketmine\item\Item::clearCustomBlockData |
( |
| ) |
|
|
inherited |
◆ clearCustomName()
pocketmine\item\Item::clearCustomName |
( |
| ) |
|
|
inherited |
◆ clearNamedTag()
pocketmine\item\Item::clearNamedTag |
( |
| ) |
|
|
inherited |
Removes the Item's NBT.
- Returns
- $this
- Exceptions
-
Definition at line 279 of file Item.php.
◆ describeState()
Describes state properties of the item, such as colour, skull type, etc. This allows associating basic extra data with the item at runtime in a more efficient format than NBT.
Reimplemented in pocketmine\item\Banner, pocketmine\item\CoralFan, pocketmine\item\Dye, pocketmine\item\ItemBlock, pocketmine\item\Medicine, pocketmine\item\Potion, pocketmine\item\SplashPotion, and pocketmine\item\SuspiciousStew.
Definition at line 513 of file Item.php.
◆ deserializeCompoundTag()
pocketmine\item\Item::deserializeCompoundTag |
( |
CompoundTag | $tag | ) |
|
|
protectedinherited |
◆ equals()
pocketmine\item\Item::equals |
( |
Item | $item, |
|
|
bool | $checkDamage = true, |
|
|
bool | $checkCompound = true ) |
|
finalinherited |
Compares an Item to this Item and check if they match.
- Parameters
-
- Deprecated
- Parameters
-
bool | $checkCompound | Whether to verify that the items' NBT match. |
Definition at line 677 of file Item.php.
◆ equalsExact()
pocketmine\item\Item::equalsExact |
( |
Item | $other | ) |
|
|
finalinherited |
Returns whether the specified item stack has the same ID, damage, NBT and count as this item stack.
Definition at line 692 of file Item.php.
◆ getAttackPoints()
pocketmine\item\Item::getAttackPoints |
( |
| ) |
|
|
inherited |
◆ getBlock()
pocketmine\item\Item::getBlock |
( |
?int | $clickedFace = null | ) |
|
|
inherited |
Returns the block corresponding to this Item.
Reimplemented in pocketmine\item\Bamboo, pocketmine\item\BeetrootSeeds, pocketmine\item\Carrot, pocketmine\item\CocoaBeans, pocketmine\item\CoralFan, pocketmine\item\GlowBerries, pocketmine\item\ItemBlock, pocketmine\item\ItemBlockWallOrFloor, pocketmine\item\MelonSeeds, pocketmine\item\PitcherPod, pocketmine\item\Potato, pocketmine\item\PumpkinSeeds, pocketmine\item\Redstone, pocketmine\item\StringItem, pocketmine\item\SweetBerries, pocketmine\item\TorchflowerSeeds, and pocketmine\item\WheatSeeds.
Definition at line 491 of file Item.php.
Referenced by pocketmine\block\Cake\onInteract().
◆ getBlockToolHarvestLevel()
pocketmine\item\Item::getBlockToolHarvestLevel |
( |
| ) |
|
|
inherited |
◆ getBlockToolType()
pocketmine\item\Item::getBlockToolType |
( |
| ) |
|
|
inherited |
◆ getCanDestroy()
pocketmine\item\Item::getCanDestroy |
( |
| ) |
|
|
inherited |
- Returns
- string[] @phpstan-return array<string, string>
Definition at line 216 of file Item.php.
◆ getCanPlaceOn()
pocketmine\item\Item::getCanPlaceOn |
( |
| ) |
|
|
inherited |
- Returns
- string[] @phpstan-return array<string, string>
Definition at line 198 of file Item.php.
◆ getCooldownTag()
pocketmine\item\Item::getCooldownTag |
( |
| ) |
|
|
inherited |
Returns a tag that identifies a group of items that should have cooldown at the same time regardless of their state or type. When cooldown starts, any other items with the same cooldown tag can't be used until the cooldown expires. Such behaviour can be seen in goat horns and shields.
If tag is null, item state id will be used to store cooldown.
- See also
- ItemCooldownTags
Reimplemented in pocketmine\item\ChorusFruit, and pocketmine\item\EnderPearl.
Definition at line 667 of file Item.php.
Referenced by pocketmine\player\Player\resetItemCooldown().
◆ getCooldownTicks()
pocketmine\item\Item::getCooldownTicks |
( |
| ) |
|
|
inherited |
◆ getCount()
pocketmine\item\Item::getCount |
( |
| ) |
|
|
inherited |
◆ getCustomBlockData()
pocketmine\item\Item::getCustomBlockData |
( |
| ) |
|
|
inherited |
◆ getCustomName()
pocketmine\item\Item::getCustomName |
( |
| ) |
|
|
inherited |
◆ getDefensePoints()
pocketmine\item\Item::getDefensePoints |
( |
| ) |
|
|
inherited |
◆ getEnchantability()
pocketmine\item\Item::getEnchantability |
( |
| ) |
|
|
inherited |
Returns the value that defines how enchantable the item is.
The higher an item's enchantability is, the more likely it will be to gain high-level enchantments or multiple enchantments upon being enchanted in an enchanting table.
Reimplemented in pocketmine\item\Armor, and pocketmine\item\TieredTool.
Definition at line 480 of file Item.php.
◆ getEnchantmentTags()
pocketmine\item\Item::getEnchantmentTags |
( |
| ) |
|
|
inherited |
Returns tags that represent the type of item being enchanted and are used to determine what enchantments can be applied to this item during in-game enchanting (enchanting table, anvil, fishing, etc.).
- See also
- ItemEnchantmentTags
-
ItemEnchantmentTagRegistry
-
AvailableEnchantmentRegistry
- Returns
- string[]
Definition at line 470 of file Item.php.
◆ getFuelResidue()
pocketmine\item\Item::getFuelResidue |
( |
| ) |
|
|
inherited |
◆ getFuelTime()
pocketmine\item\Item::getFuelTime |
( |
| ) |
|
|
inherited |
Returns the time in ticks which the item will fuel a furnace for.
Reimplemented in pocketmine\item\Bamboo, pocketmine\item\Banner, pocketmine\item\BlazeRod, pocketmine\item\Boat, pocketmine\item\Bow, pocketmine\item\Bowl, pocketmine\item\Coal, pocketmine\item\CoralFan, pocketmine\item\ItemBlock, pocketmine\item\ItemBlockWallOrFloor, pocketmine\item\LiquidBucket, pocketmine\item\Stick, and pocketmine\item\TieredTool.
Definition at line 527 of file Item.php.
◆ getLore()
pocketmine\item\Item::getLore |
( |
| ) |
|
|
inherited |
- Returns
- string[]
Definition at line 174 of file Item.php.
◆ getMaxStackSize()
pocketmine\item\Item::getMaxStackSize |
( |
| ) |
|
|
inherited |
Returns the highest amount of this item which will fit into one inventory slot.
Reimplemented in pocketmine\item\Armor, pocketmine\item\BeetrootSoup, pocketmine\item\Boat, pocketmine\item\Bucket, pocketmine\item\CoralFan, pocketmine\item\Egg, pocketmine\item\EnchantedBook, pocketmine\item\EnderPearl, pocketmine\item\FishingRod, pocketmine\item\HoneyBottle, pocketmine\item\ItemBlock, pocketmine\item\ItemBlockWallOrFloor, pocketmine\item\LiquidBucket, pocketmine\item\Medicine, pocketmine\item\MilkBucket, pocketmine\item\Minecart, pocketmine\item\MushroomStew, pocketmine\item\Potion, pocketmine\item\RabbitStew, pocketmine\item\Record, pocketmine\item\Snowball, pocketmine\item\SplashPotion, pocketmine\item\Spyglass, pocketmine\item\SuspiciousStew, pocketmine\item\Tool, pocketmine\item\Totem, pocketmine\item\WritableBookBase, and pocketmine\item\WrittenBook.
Definition at line 520 of file Item.php.
◆ getMiningEfficiency()
pocketmine\item\Item::getMiningEfficiency |
( |
bool | $isCorrectTool | ) |
|
|
inherited |
◆ getName()
pocketmine\item\Item::getName |
( |
| ) |
|
|
finalinherited |
Returns the name of the item, or the custom name if it is set.
Definition at line 450 of file Item.php.
◆ getNamedTag()
pocketmine\item\Item::getNamedTag |
( |
| ) |
|
|
inherited |
Returns a tree of Tag objects representing the Item's NBT. If the item does not have any NBT, an empty CompoundTag object is returned to allow the caller to manipulate and apply back to the item.
Definition at line 252 of file Item.php.
◆ getStateId()
pocketmine\item\Item::getStateId |
( |
| ) |
|
|
finalinherited |
◆ getTypeId()
pocketmine\item\Item::getTypeId |
( |
| ) |
|
|
finalinherited |
◆ getVanillaName()
pocketmine\item\Item::getVanillaName |
( |
| ) |
|
|
inherited |
Returns the vanilla name of the item, disregarding custom names.
Definition at line 457 of file Item.php.
◆ hasCustomBlockData()
pocketmine\item\Item::hasCustomBlockData |
( |
| ) |
|
|
inherited |
◆ hasCustomName()
pocketmine\item\Item::hasCustomName |
( |
| ) |
|
|
inherited |
◆ hasNamedTag()
pocketmine\item\Item::hasNamedTag |
( |
| ) |
|
|
inherited |
Returns whether this Item has a non-empty NBT.
Definition at line 244 of file Item.php.
◆ isFireProof()
pocketmine\item\Item::isFireProof |
( |
| ) |
|
|
inherited |
◆ isNull()
pocketmine\item\Item::isNull |
( |
| ) |
|
|
inherited |
◆ jsonSerialize()
pocketmine\item\Item::jsonSerialize |
( |
| ) |
|
|
inherited |
@phpstan-return never
Definition at line 703 of file Item.php.
◆ keepOnDeath()
pocketmine\item\Item::keepOnDeath |
( |
| ) |
|
|
inherited |
Returns whether players will retain this item on death. If a non-player dies it will be excluded from the drops.
Definition at line 233 of file Item.php.
◆ legacyJsonDeserialize()
static pocketmine\item\Item::legacyJsonDeserialize |
( |
array | $data | ) |
|
|
staticfinalinherited |
Deserializes item JSON data produced by json_encode()ing Item instances in older versions of PocketMine-MP. This method exists solely to allow upgrading old JSON data stored by plugins.
- Parameters
-
- Exceptions
-
SavedDataLoadingException | |
Definition at line 715 of file Item.php.
◆ nbtDeserialize()
static pocketmine\item\Item::nbtDeserialize |
( |
CompoundTag | $tag | ) |
|
|
staticinherited |
Deserializes an Item from an NBT CompoundTag
- Exceptions
-
SavedDataLoadingException | |
Definition at line 754 of file Item.php.
◆ nbtSerialize()
pocketmine\item\Item::nbtSerialize |
( |
int | $slot = -1 | ) |
|
|
inherited |
Serializes the item to an NBT CompoundTag
- Parameters
-
int | $slot | optional, the inventory slot of the item |
Definition at line 746 of file Item.php.
◆ onAttackEntity()
pocketmine\item\Item::onAttackEntity |
( |
Entity | $victim, |
|
|
array & | $returnedItems ) |
|
inherited |
◆ onClickAir()
pocketmine\item\Item::onClickAir |
( |
Player | $player, |
|
|
Vector3 | $directionVector, |
|
|
array & | $returnedItems ) |
|
inherited |
Called when a player uses the item on air, for example throwing a projectile. Returns whether the item was changed, for example count decrease or durability change.
- Parameters
-
Item[] | &$returnedItems | Items to be added to the target's inventory (or dropped, if the inventory is full) |
Reimplemented in pocketmine\item\Armor, and pocketmine\item\ProjectileItem.
Definition at line 600 of file Item.php.
◆ onDestroyBlock()
pocketmine\item\Item::onDestroyBlock |
( |
Block | $block, |
|
|
array & | $returnedItems ) |
|
inherited |
◆ onInteractBlock()
pocketmine\item\Item::onInteractBlock |
( |
Player | $player, |
|
|
Block | $blockReplace, |
|
|
Block | $blockClicked, |
|
|
int | $face, |
|
|
Vector3 | $clickVector, |
|
|
array & | $returnedItems ) |
|
inherited |
◆ onInteractEntity()
pocketmine\item\Item::onInteractEntity |
( |
Player | $player, |
|
|
Entity | $entity, |
|
|
Vector3 | $clickVector ) |
|
inherited |
Called when a player uses the item to interact with entity, for example by using a name tag.
- Parameters
-
Vector3 | $clickVector | The exact position of the click (absolute coordinates) |
- Returns
- bool whether some action took place
Reimplemented in pocketmine\item\NameTag.
Definition at line 646 of file Item.php.
◆ onReleaseUsing()
pocketmine\item\Item::onReleaseUsing |
( |
Player | $player, |
|
|
array & | $returnedItems ) |
|
inherited |
Called when a player is using this item and releases it. Used to handle bow shoot actions. Returns whether the item was changed, for example count decrease or durability change.
- Parameters
-
Item[] | &$returnedItems | Items to be added to the target's inventory (or dropped, if the inventory is full) |
Reimplemented in pocketmine\item\Bow.
Definition at line 610 of file Item.php.
◆ onTickWorn()
pocketmine\item\Item::onTickWorn |
( |
Living | $entity | ) |
|
|
inherited |
◆ pop()
pocketmine\item\Item::pop |
( |
int | $count = 1 | ) |
|
|
inherited |
Pops an item from the stack and returns it, decreasing the stack count of this item stack by one.
- Returns
- static A clone of this itemstack containing the amount of items that were removed from this stack.
- Exceptions
-
InvalidArgumentException if trying to pop more items than are on the stack
Definition at line 430 of file Item.php.
Referenced by pocketmine\block\Bamboo\onInteract(), pocketmine\block\BambooSapling\onInteract(), pocketmine\block\BaseBigDripleaf\onInteract(), pocketmine\block\Cake\onInteract(), pocketmine\block\CocoaBlock\onInteract(), pocketmine\block\Crops\onInteract(), pocketmine\block\DoublePitcherCrop\onInteract(), pocketmine\block\GlowLichen\onInteract(), pocketmine\block\Jukebox\onInteract(), pocketmine\block\Lectern\onInteract(), pocketmine\block\NetherVines\onInteract(), pocketmine\block\PinkPetals\onInteract(), pocketmine\block\PitcherCrop\onInteract(), pocketmine\block\Sapling\onInteract(), pocketmine\block\SmallDripleaf\onInteract(), pocketmine\block\Sugarcane\onInteract(), pocketmine\block\SweetBerryBush\onInteract(), pocketmine\block\TNT\onInteract(), pocketmine\block\TorchflowerCrop\onInteract(), pocketmine\item\FireCharge\onInteractBlock(), pocketmine\item\GlassBottle\onInteractBlock(), and pocketmine\item\NameTag\onInteractEntity().
◆ serializeCompoundTag()
pocketmine\item\Item::serializeCompoundTag |
( |
CompoundTag | $tag | ) |
|
|
protectedinherited |
◆ setCanDestroy()
pocketmine\item\Item::setCanDestroy |
( |
array | $canDestroy | ) |
|
|
inherited |
◆ setCanPlaceOn()
pocketmine\item\Item::setCanPlaceOn |
( |
array | $canPlaceOn | ) |
|
|
inherited |
◆ setCount()
pocketmine\item\Item::setCount |
( |
int | $count | ) |
|
|
inherited |
◆ setCustomBlockData()
pocketmine\item\Item::setCustomBlockData |
( |
CompoundTag | $compound | ) |
|
|
inherited |
◆ setCustomName()
pocketmine\item\Item::setCustomName |
( |
string | $name | ) |
|
|
inherited |
◆ setKeepOnDeath()
pocketmine\item\Item::setKeepOnDeath |
( |
bool | $keepOnDeath | ) |
|
|
inherited |
◆ setLore()
pocketmine\item\Item::setLore |
( |
array | $lines | ) |
|
|
inherited |
- Parameters
-
- Returns
- $this
Definition at line 183 of file Item.php.
◆ setNamedTag()
Sets the Item's NBT from the supplied CompoundTag object.
- Returns
- $this
- Exceptions
-
Definition at line 263 of file Item.php.
◆ $blockEntityTag
CompoundTag pocketmine\item\Item::$blockEntityTag = null |
|
protectedinherited |
TODO: this needs to die in a fire
Definition at line 88 of file Item.php.
◆ $canDestroy
array pocketmine\item\Item::$canDestroy = [] |
|
protectedinherited |
◆ $canPlaceOn
array pocketmine\item\Item::$canPlaceOn = [] |
|
protectedinherited |
◆ $count
int pocketmine\item\Item::$count = 1 |
|
protectedinherited |
◆ $customName
string pocketmine\item\Item::$customName = "" |
|
protectedinherited |
◆ $keepOnDeath
bool pocketmine\item\Item::$keepOnDeath = false |
|
protectedinherited |
◆ $lore
array pocketmine\item\Item::$lore = [] |
|
protectedinherited |
◆ TAG_BLOCK_ENTITY_TAG
const pocketmine\item\Item::TAG_BLOCK_ENTITY_TAG = "BlockEntityTag" |
|
inherited |
◆ TAG_DISPLAY
const pocketmine\item\Item::TAG_DISPLAY = "display" |
|
inherited |
◆ TAG_DISPLAY_LORE
const pocketmine\item\Item::TAG_DISPLAY_LORE = "Lore" |
|
inherited |
◆ TAG_DISPLAY_NAME
const pocketmine\item\Item::TAG_DISPLAY_NAME = "Name" |
|
inherited |
◆ TAG_ENCH
const pocketmine\item\Item::TAG_ENCH = "ench" |
|
inherited |
◆ TAG_KEEP_ON_DEATH
const pocketmine\item\Item::TAG_KEEP_ON_DEATH = "minecraft:keep_on_death" |
|
inherited |
The documentation for this class was generated from the following file: