public interface IForgeItem
| Modifier and Type | Method and Description |
|---|---|
default boolean |
canApplyAtEnchantingTable(ItemStack stack,
Enchantment enchantment)
Checks whether an item can be enchanted with a certain enchantment.
|
default boolean |
canContinueUsing(ItemStack oldStack,
ItemStack newStack)
Called while an item is in 'active' use to determine if usage should
continue.
|
default boolean |
canDisableShield(ItemStack stack,
ItemStack shield,
EntityLivingBase entity,
EntityLivingBase attacker)
Can this Item disable a shield
|
default boolean |
canEquip(ItemStack stack,
EntityEquipmentSlot armorType,
Entity entity)
Determines if the specific ItemStack can be placed in the specified armor
slot, for the entity.
|
default boolean |
canHarvestBlock(ItemStack stack,
IBlockState state)
ItemStack sensitive version of
#canHarvestBlock(IBlockState) |
default Entity |
createEntity(World world,
Entity location,
ItemStack itemstack)
This function should return a new entity to replace the dropped item.
|
default boolean |
doesSneakBypassUse(ItemStack stack,
IWorldReader world,
BlockPos pos,
EntityPlayer player)
Should this item, when held, allow sneak-clicks to pass through to the
underlying block?
|
default com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> |
getAnimationParameters(ItemStack stack,
World world,
EntityLivingBase entity) |
default ModelBiped |
getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack,
EntityEquipmentSlot armorSlot,
ModelBiped _default)
Override this method to have an item handle its own armor rendering.
|
default java.lang.String |
getArmorTexture(ItemStack stack,
Entity entity,
EntityEquipmentSlot slot,
java.lang.String type)
Called by RenderBiped and RenderPlayer to determine the armor texture that
should be use for the currently equipped item.
|
default com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getAttributeModifiers(EntityEquipmentSlot slot,
ItemStack stack)
ItemStack sensitive version of getItemAttributeModifiers
|
default int |
getBurnTime(ItemStack itemStack) |
default ItemStack |
getContainerItem(ItemStack itemStack)
ItemStack sensitive version of getContainerItem.
|
default java.util.Collection<ItemGroup> |
getCreativeTabs()
Gets a list of tabs that items belonging to this class can display on,
combined properly with getSubItems allows for a single item to span many
sub-items across many tabs.
|
default java.lang.String |
getCreatorModId(ItemStack itemStack)
Called to get the Mod ID of the mod that *created* the ItemStack, instead of
the real Mod ID that *registered* it.
|
default int |
getDamage(ItemStack stack)
Return the itemDamage represented by this ItemStack.
|
default double |
getDurabilityForDisplay(ItemStack stack)
Queries the percentage of the 'Durability' bar that should be drawn.
|
default int |
getEntityLifespan(ItemStack itemStack,
World world)
Retrieves the normal 'lifespan' of this item when it is dropped on the ground
as a EntityItem.
|
default EntityEquipmentSlot |
getEquipmentSlot(ItemStack stack)
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 FontRenderer |
getFontRenderer(ItemStack stack)
Returns the font renderer used to render tooltips and overlays for this item.
|
int |
getHarvestLevel(ItemStack stack,
ToolType tool,
EntityPlayer player,
IBlockState blockState)
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 java.lang.String |
getHighlightTip(ItemStack item,
java.lang.String displayName)
Allow the item one last chance to modify its name used for the tool highlight
useful for adding something extra that can't be removed by a user in the
displayed name, such as a mode of operation.
|
default HorseArmorType |
getHorseArmorType(ItemStack stack)
Returns an enum constant of type
HorseArmorType. |
default Item |
getItem() |
default int |
getItemEnchantability(ItemStack stack)
ItemStack sensitive version of getItemEnchantability
|
default int |
getItemStackLimit(ItemStack stack)
Gets the maximum number of items that this stack should be able to hold.
|
default int |
getMaxDamage(ItemStack stack)
Return the maxDamage for this ItemStack.
|
default int |
getRGBDurabilityForDisplay(ItemStack stack)
Returns the packed int RGB value used to render the durability bar in the
GUI.
|
default NBTTagCompound |
getShareTag(ItemStack stack)
Override this method to change the NBT data being sent to the client.
|
default float |
getSmeltingExperience(ItemStack item)
Determines the base experience for a player when they remove this item from a
furnace slot.
|
TileEntityItemStackRenderer |
getTileEntityItemStackRenderer() |
java.util.Set<ToolType> |
getToolTypes(ItemStack stack) |
default float |
getXpRepairRatio(ItemStack stack)
Determines the amount of durability the mending enchantment
will repair, on average, per point of experience.
|
default boolean |
hasContainerItem(ItemStack stack)
ItemStack sensitive version of hasContainerItem
|
default boolean |
hasCustomEntity(ItemStack stack)
Determines if this Item has a special entity for when they are in the world.
|
default ICapabilityProvider |
initCapabilities(ItemStack stack,
NBTTagCompound nbt)
Called from ItemStack.setItem, will hold extra data for the life of this
ItemStack.
|
default boolean |
isBeaconPayment(ItemStack stack)
Whether this Item can be used as a payment to activate the vanilla beacon.
|
default boolean |
isBookEnchantable(ItemStack stack,
ItemStack book)
Allow or forbid the specific book/item combination as an anvil enchant
|
default boolean |
isDamaged(ItemStack stack)
Return if this itemstack is damaged.
|
boolean |
isRepairable()
Called by CraftingManager to determine if an item is reparable.
|
default boolean |
isShield(ItemStack stack,
EntityLivingBase entity)
Is this Item a shield
|
default void |
onArmorTick(ItemStack stack,
World world,
EntityPlayer player)
Called to tick armor in the armor slot.
|
default boolean |
onBlockStartBreak(ItemStack itemstack,
BlockPos pos,
EntityPlayer player)
Called before a block is broken.
|
default boolean |
onDroppedByPlayer(ItemStack item,
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(ItemStack stack,
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(ItemStack stack,
EntityLivingBase entity)
Called when a entity tries to play the 'swing' animation.
|
default void |
onHorseArmorTick(ItemStack stack,
World world,
EntityLiving horse)
Called every tick from
EntityHorse#onUpdate() on the item in the
armor slot. |
default EnumActionResult |
onItemUseFirst(ItemStack stack,
ItemUseContext context)
This is called when the item is used, before the block is activated.
|
default boolean |
onLeftClickEntity(ItemStack stack,
EntityPlayer player,
Entity entity)
Called when the player Left Clicks (attacks) an entity.
|
default void |
onUsingTick(ItemStack stack,
EntityLivingBase player,
int count)
Called each tick while using an item.
|
default void |
readShareTag(ItemStack stack,
NBTTagCompound nbt)
Override this method to decide what to do with the NBT data received from
getNBTShareTag().
|
default void |
renderHelmetOverlay(ItemStack stack,
EntityPlayer player,
int width,
int height,
float partialTicks)
Called when the client starts rendering the HUD, for whatever item the player
currently has as a helmet.
|
default void |
setDamage(ItemStack stack,
int damage)
Set the damage for this itemstack.
|
default boolean |
shouldCauseBlockBreakReset(ItemStack oldStack,
ItemStack newStack)
Called when the player is mining a block and the item in his hand changes.
|
default boolean |
shouldCauseReequipAnimation(ItemStack oldStack,
ItemStack newStack,
boolean slotChanged)
Determine if the player switching between these two item stacks
|
default boolean |
showDurabilityBar(ItemStack stack)
Determines if the durability bar should be rendered for this item.
|
default Item getItem()
default com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
default boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
player - The player that dropped the itemitem - The item stack, before the item is removed.default java.lang.String getHighlightTip(ItemStack item, java.lang.String displayName)
item - the ItemStack for the item.displayName - the name that will be displayed unless it is changed in
this method.default EnumActionResult onItemUseFirst(ItemStack stack, ItemUseContext context)
boolean isRepairable()
default float getXpRepairRatio(ItemStack stack)
@Nullable default NBTTagCompound getShareTag(ItemStack stack)
stack - The stack to send the NBT tag fordefault void readShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
stack - The stack that received NBTnbt - Received NBT, can be nulldefault boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
itemstack - The current ItemStackpos - Block's position in worldplayer - The Player that is wielding the itemdefault void onUsingTick(ItemStack stack, EntityLivingBase player, int count)
stack - The Item being usedplayer - The Player using the itemcount - The amount of time in tick the item has been used for
continuouslydefault boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
stack - The Item being usedplayer - The player that is attackingentity - The entity being attackeddefault ItemStack getContainerItem(ItemStack itemStack)
itemStack - The current ItemStackdefault boolean hasContainerItem(ItemStack stack)
stack - The current item stackdefault int getEntityLifespan(ItemStack itemStack, World world)
itemStack - The current ItemStackworld - The world the entity is indefault boolean hasCustomEntity(ItemStack stack)
stack - The current item stack@Nullable default Entity createEntity(World world, Entity location, ItemStack itemstack)
world - The world objectlocation - The EntityItem object, useful for getting the position of
the entityitemstack - The current item stackdefault boolean onEntityItemUpdate(ItemStack stack, EntityItem entity)
entity - The entity Itemdefault java.util.Collection<ItemGroup> getCreativeTabs()
default float getSmeltingExperience(ItemStack item)
item - The item stack the player is picking up.default boolean doesSneakBypassUse(ItemStack stack, IWorldReader world, BlockPos pos, EntityPlayer player)
world - The worldpos - Block position in worldplayer - The Player that is wielding the itemdefault void onArmorTick(ItemStack stack, World world, EntityPlayer player)
default boolean canEquip(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
stack - The ItemStackarmorType - Armor slot to be verified.entity - The entity trying to equip the armor@Nullable default EntityEquipmentSlot getEquipmentSlot(ItemStack stack)
EntityLiving.getSlotForItemStack(ItemStack).stack - the ItemStacknull to let the default
vanilla logic as per EntityLiving.getSlotForItemStack(stack)
decidedefault boolean isBookEnchantable(ItemStack stack, ItemStack book)
stack - The itembook - The book@Nullable default java.lang.String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, java.lang.String type)
stack - ItemStack for the equipped armorentity - The entity wearing the armorslot - The slot the armor is intype - The subtype, can be null or "overlay"@Nullable default FontRenderer getFontRenderer(ItemStack stack)
stack - The current item stack@Nullable default ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
entityLiving - The entity wearing the armoritemStack - The itemStack to render the model ofarmorSlot - The slot the armor is in_default - Original armor model. Will have attributes set.default boolean onEntitySwing(ItemStack stack, EntityLivingBase entity)
entity - The entity swinging the item.default void renderHelmetOverlay(ItemStack stack, EntityPlayer player, int width, int height, float partialTicks)
stack - The ItemStack that is equippedplayer - Reference to the current client entityresolution - Resolution information about the current viewport and
configured GUI ScalepartialTicks - Partial ticks for the renderer, useful for interpolationdefault int getDamage(ItemStack stack)
stack - The itemstack that is damageddefault boolean showDurabilityBar(ItemStack stack)
stack - The current Item Stackdefault double getDurabilityForDisplay(ItemStack stack)
stack - The current ItemStackdefault int getRGBDurabilityForDisplay(ItemStack stack)
getDurabilityForDisplay(net.minecraft.item.ItemStack), but can be overriden.stack - Stack to get durability fromdefault int getMaxDamage(ItemStack stack)
stack - The itemstack that is damageddefault boolean isDamaged(ItemStack stack)
#isDamageable() is true.stack - the stackdefault void setDamage(ItemStack stack, int damage)
stack - the stackdamage - the new damage valuedefault boolean canHarvestBlock(ItemStack stack, IBlockState state)
#canHarvestBlock(IBlockState)stack - The itemstack used to harvest the blockstate - The block trying to harvestdefault int getItemStackLimit(ItemStack stack)
stack - The ItemStackint getHarvestLevel(ItemStack stack, ToolType tool, @Nullable EntityPlayer player, @Nullable IBlockState blockState)
stack - This item stack instancetoolClass - Tool Classplayer - The player trying to harvest the given blockstateblockState - The block to harvestdefault int getItemEnchantability(ItemStack stack)
stack - The ItemStackdefault boolean canApplyAtEnchantingTable(ItemStack stack, 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 boolean isBeaconPayment(ItemStack stack)
stack - the ItemStackdefault boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged)
oldStack - The old stack that was equippednewStack - The new stackslotChanged - If the current equipped slot was changed, Vanilla does not
play the animation if you switch between two slots that
hold the exact same item.default boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack)
oldStack - The old stack that was used for mining. Item in players main
handnewStack - The new stackdefault boolean canContinueUsing(ItemStack oldStack, ItemStack newStack)
oldStack - the previous 'active' stacknewStack - the stack currently in the active hand@Nullable default java.lang.String getCreatorModId(ItemStack itemStack)
itemStack - the ItemStack to check#getRegistryName() would return null.@Nullable default ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt)
stack - The ItemStacknbt - NBT of this item serialized, or null.default com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> getAnimationParameters(ItemStack stack, World world, EntityLivingBase entity)
default boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker)
stack - The ItemStackshield - The shield in questionentity - The EntityLivingBase holding the shieldattacker - The EntityLivingBase holding the ItemStackdefault boolean isShield(ItemStack stack, @Nullable EntityLivingBase entity)
stack - The ItemStackentity - The Entity holding the ItemStackdefault int getBurnTime(ItemStack itemStack)
default HorseArmorType getHorseArmorType(ItemStack stack)
HorseArmorType. The returned enum
constant will be used to determine the armor value and texture of this item
when equipped.stack - the armor stackHorseArmorType. Return
HorseArmorType.NONE if this is not horse armordefault void onHorseArmorTick(ItemStack stack, World world, EntityLiving horse)
EntityHorse#onUpdate() on the item in the
armor slot.stack - the armor itemstackworld - the world the horse is inhorse - the horse wearing this armorTileEntityItemStackRenderer getTileEntityItemStackRenderer()