public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
| Modifier and Type | Method and Description |
|---|---|
default boolean |
areShareTagsEqual(ItemStack other)
Modeled after ItemStack.areItemStackTagsEqual
Uses Item.getNBTShareTag for comparison instead of NBT and capabilities.
|
default boolean |
canApplyAtEnchantingTable(Enchantment enchantment)
Checks whether an item can be enchanted with a certain enchantment.
|
default boolean |
canDisableShield(ItemStack shield,
EntityLivingBase entity,
EntityLivingBase attacker)
Can this Item disable a shield
|
default boolean |
canEquip(EntityEquipmentSlot armorType,
Entity entity)
Determines if the specific ItemStack can be placed in the specified armor
slot, for the entity.
|
default boolean |
doesSneakBypassUse(IWorldReader world,
BlockPos pos,
EntityPlayer player)
Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
default boolean |
equals(ItemStack other,
boolean limitTags)
Determines if the ItemStack is equal to the other item stack, including Item, Count, and NBT.
|
default int |
getBurnTime() |
default ItemStack |
getContainerItem()
ItemStack sensitive version of getContainerItem.
|
default int |
getEntityLifespan(World world)
Retrieves the normal 'lifespan' of this item when it is dropped on the ground
as a EntityItem.
|
default EntityEquipmentSlot |
getEquipmentSlot()
Override this to set a non-default armor slot for an ItemStack, but do
not use this to get the armor slot of said stack; for that, use
EntityLiving.getSlotForItemStack(ItemStack). |
default int |
getHarvestLevel(ToolType tool,
EntityPlayer player,
IBlockState state)
Queries the harvest level of this item stack for the specified tool class,
Returns -1 if this tool is not of the specified type
|
default HorseArmorType |
getHorseArmorType()
Returns an enum constant of type
HorseArmorType. |
default int |
getItemEnchantability()
ItemStack sensitive version of getItemEnchantability
|
default NBTTagCompound |
getShareTag()
Get the NBT data to be sent to the client.
|
default ItemStack |
getStack() |
default java.util.Set<ToolType> |
getToolTypes() |
default boolean |
hasContainerItem()
ItemStack sensitive version of hasContainerItem
|
default boolean |
isBeaconPayment()
Whether this Item can be used as a payment to activate the vanilla beacon.
|
default boolean |
isBookEnchantable(ItemStack book)
Allow or forbid the specific book/item combination as an anvil enchant
|
default boolean |
isShield(EntityLivingBase entity)
Is this Item a shield
|
default void |
onArmorTick(World world,
EntityPlayer player)
Called to tick armor in the armor slot.
|
default boolean |
onBlockStartBreak(BlockPos pos,
EntityPlayer player)
Called before a block is broken.
|
default boolean |
onDroppedByPlayer(EntityPlayer player)
Called when a player drops the item into the world, returning false from this
will prevent the item from being removed from the players inventory and
spawning in the world
|
default boolean |
onEntityItemUpdate(EntityItem entity)
Called by the default implemetation of EntityItem's onUpdate method, allowing
for cleaner control over the update of the item without having to write a
subclass.
|
default boolean |
onEntitySwing(EntityLivingBase entity)
Called when a entity tries to play the 'swing' animation.
|
default void |
onHorseArmorTick(World world,
EntityLiving horse)
Called every tick from
EntityHorse#onUpdate() on the item in the
armor slot. |
default EnumActionResult |
onItemUseFirst(ItemUseContext context) |
default void |
onUsingTick(EntityLivingBase player,
int count)
Called each tick while using an item.
|
default void |
readShareTag(NBTTagCompound nbt)
Override this method to decide what to do with the NBT data received from
getNBTShareTag().
|
default NBTTagCompound |
serializeNBT() |
default boolean |
shouldCauseBlockBreakReset(ItemStack newStack)
Called when the player is mining a block and the item in his hand changes.
|
getCapability, getCapabilitydeserializeNBTdefault ItemStack getStack()
default ItemStack getContainerItem()
itemStack - The current ItemStackdefault boolean hasContainerItem()
stack - The current item stackdefault int getBurnTime()
default int getHarvestLevel(ToolType tool, @Nullable EntityPlayer player, @Nullable IBlockState state)
stack - This item stack instancetoolClass - Tool Classplayer - The player trying to harvest the given blockstatestate - The block to harvestdefault java.util.Set<ToolType> getToolTypes()
default EnumActionResult onItemUseFirst(ItemUseContext context)
default NBTTagCompound serializeNBT()
serializeNBT in interface INBTSerializable<NBTTagCompound>default boolean onBlockStartBreak(BlockPos pos, EntityPlayer player)
pos - Block's position in worldplayer - The Player that is wielding the itemdefault boolean shouldCauseBlockBreakReset(ItemStack newStack)
newStack - The new stackdefault boolean canApplyAtEnchantingTable(Enchantment enchantment)
Enchantment.canApplyAtEnchantingTable(ItemStack);
check the individual implementation for reference. By default this will check
if the enchantment type is valid for this item type.stack - the item stack to be enchantedenchantment - the enchantment to be applieddefault int getItemEnchantability()
@Nullable default EntityEquipmentSlot getEquipmentSlot()
EntityLiving.getSlotForItemStack(ItemStack).null to let the default
vanilla logic as per EntityLiving.getSlotForItemStack(stack)
decidedefault boolean canDisableShield(ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker)
shield - The shield in questionentity - The EntityLivingBase holding the shieldattacker - The EntityLivingBase holding the ItemStackdefault boolean isShield(@Nullable
EntityLivingBase entity)
entity - The Entity holding the ItemStackdefault boolean onEntitySwing(EntityLivingBase entity)
entity - The entity swinging the item.default void onUsingTick(EntityLivingBase player, int count)
player - The Player using the itemcount - The amount of time in tick the item has been used for
continuouslydefault int getEntityLifespan(World world)
world - The world the entity is indefault boolean onEntityItemUpdate(EntityItem entity)
entity - The entity Itemdefault HorseArmorType getHorseArmorType()
HorseArmorType. The returned enum
constant will be used to determine the armor value and texture of this item
when equipped.HorseArmorType. Return
HorseArmorType.NONE if this is not horse armordefault void onArmorTick(World world, EntityPlayer player)
default void onHorseArmorTick(World world, EntityLiving horse)
EntityHorse#onUpdate() on the item in the
armor slot.world - the world the horse is inhorse - the horse wearing this armordefault boolean isBeaconPayment()
default boolean canEquip(EntityEquipmentSlot armorType, Entity entity)
armorType - Armor slot to be verified.entity - The entity trying to equip the armordefault boolean isBookEnchantable(ItemStack book)
stack - The itembook - The bookdefault boolean onDroppedByPlayer(EntityPlayer player)
player - The player that dropped the itemitem - The item stack, before the item is removed.@Nullable default NBTTagCompound getShareTag()
default void readShareTag(@Nullable
NBTTagCompound nbt)
stack - The stack that received NBTnbt - Received NBT, can be nulldefault boolean doesSneakBypassUse(IWorldReader world, BlockPos pos, EntityPlayer player)
world - The worldpos - Block position in worldplayer - The Player that is wielding the itemdefault boolean areShareTagsEqual(ItemStack other)
default boolean equals(ItemStack other, boolean limitTags)
other - The other stacklimitTags - True to use shareTag False to use full NBT tag