public class Item extends IForgeRegistryEntry.Impl<Item>
Modifier and Type | Class and Description |
---|---|
static class |
Item.ToolMaterial |
IForgeRegistryEntry.Impl<T extends IForgeRegistryEntry<T>>
Modifier and Type | Field and Description |
---|---|
protected static java.util.UUID |
ATTACK_DAMAGE_MODIFIER |
protected static java.util.UUID |
ATTACK_SPEED_MODIFIER |
protected boolean |
bFull3D |
private static java.util.Map<Block,Item> |
BLOCK_TO_ITEM |
protected boolean |
canRepair |
private Item |
containerItem |
private static IItemPropertyGetter |
COOLDOWN_GETTER |
private static IItemPropertyGetter |
DAMAGE_GETTER |
private static IItemPropertyGetter |
DAMAGED_GETTER |
protected boolean |
hasSubtypes |
protected static java.util.Random |
itemRand |
private static IItemPropertyGetter |
LEFTHANDED_GETTER |
private int |
maxDamage |
protected int |
maxStackSize |
private IRegistry<ResourceLocation,IItemPropertyGetter> |
properties |
static RegistryNamespaced<ResourceLocation,Item> |
REGISTRY |
private CreativeTabs |
tabToDisplayOn |
private TileEntityItemStackRenderer |
teisr |
private java.util.Map<java.lang.String,java.lang.Integer> |
toolClasses |
private java.lang.String |
unlocalizedName |
delegate
Constructor and Description |
---|
Item() |
Modifier and Type | Method and Description |
---|---|
void |
addInformation(ItemStack stack,
World worldIn,
java.util.List<java.lang.String> tooltip,
ITooltipFlag flagIn) |
void |
addPropertyOverride(ResourceLocation key,
IItemPropertyGetter getter) |
boolean |
canApplyAtEnchantingTable(ItemStack stack,
Enchantment enchantment)
Checks whether an item can be enchanted with a certain enchantment.
|
boolean |
canContinueUsing(ItemStack oldStack,
ItemStack newStack)
Called while an item is in 'active' use to determine if usage should continue.
|
boolean |
canDestroyBlockInCreative(World world,
BlockPos pos,
ItemStack stack,
EntityPlayer player)
Checked from
PlayerControllerMP.onPlayerDestroyBlock()
when a creative player left-clicks a block with this item. |
boolean |
canDisableShield(ItemStack stack,
ItemStack shield,
EntityLivingBase entity,
EntityLivingBase attacker)
Can this Item disable a shield
|
boolean |
canHarvestBlock(IBlockState blockIn) |
boolean |
canHarvestBlock(IBlockState state,
ItemStack stack)
ItemStack sensitive version of
canHarvestBlock(IBlockState) |
boolean |
canItemEditBlocks() |
Entity |
createEntity(World world,
Entity location,
ItemStack itemstack)
This function should return a new entity to replace the dropped item.
|
boolean |
doesSneakBypassUse(ItemStack stack,
IBlockAccess world,
BlockPos pos,
EntityPlayer player)
Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> |
getAnimationParameters(ItemStack stack,
World world,
EntityLivingBase entity) |
ModelBiped |
getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack,
EntityEquipmentSlot armorSlot,
ModelBiped _default)
Override this method to have an item handle its own armor rendering.
|
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.
|
com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getAttributeModifiers(EntityEquipmentSlot slot,
ItemStack stack)
ItemStack sensitive version of getItemAttributeModifiers
|
static Item |
getByNameOrId(java.lang.String id) |
Item |
getContainerItem() |
ItemStack |
getContainerItem(ItemStack itemStack)
ItemStack sensitive version of getContainerItem.
|
CreativeTabs |
getCreativeTab() |
CreativeTabs[] |
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.
|
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.
|
int |
getDamage(ItemStack stack)
Return the itemDamage represented by this ItemStack.
|
ItemStack |
getDefaultInstance() |
float |
getDestroySpeed(ItemStack stack,
IBlockState state) |
double |
getDurabilityForDisplay(ItemStack stack)
Queries the percentage of the 'Durability' bar that should be drawn.
|
int |
getEntityLifespan(ItemStack itemStack,
World world)
Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem.
|
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) . |
FontRenderer |
getFontRenderer(ItemStack stack)
Returns the font renderer used to render tooltips and overlays for this item.
|
IRarity |
getForgeRarity(ItemStack stack) |
int |
getHarvestLevel(ItemStack stack,
java.lang.String toolClass,
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
|
boolean |
getHasSubtypes() |
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.
|
java.lang.String |
getHorseArmorTexture(EntityLiving wearer,
ItemStack stack) |
HorseArmorType |
getHorseArmorType(ItemStack stack)
Returns an enum constant of type
HorseArmorType . |
static int |
getIdFromItem(Item itemIn) |
boolean |
getIsRepairable(ItemStack toRepair,
ItemStack repair) |
com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
Deprecated.
|
int |
getItemBurnTime(ItemStack itemStack) |
static Item |
getItemById(int id) |
int |
getItemEnchantability() |
int |
getItemEnchantability(ItemStack stack)
ItemStack sensitive version of getItemEnchantability
|
static Item |
getItemFromBlock(Block blockIn) |
java.lang.String |
getItemStackDisplayName(ItemStack stack) |
int |
getItemStackLimit()
Deprecated.
|
int |
getItemStackLimit(ItemStack stack)
Gets the maximum number of items that this stack should be able to hold.
|
EnumAction |
getItemUseAction(ItemStack stack) |
int |
getMaxDamage()
Deprecated.
|
int |
getMaxDamage(ItemStack stack)
Return the maxDamage for this ItemStack.
|
int |
getMaxItemUseDuration(ItemStack stack) |
int |
getMetadata(int damage) |
int |
getMetadata(ItemStack stack)
This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage.
|
NBTTagCompound |
getNBTShareTag(ItemStack stack)
Override this method to change the NBT data being sent to the client.
|
IItemPropertyGetter |
getPropertyGetter(ResourceLocation key) |
EnumRarity |
getRarity(ItemStack stack)
Deprecated.
|
int |
getRGBDurabilityForDisplay(ItemStack stack)
Returns the packed int RGB value used to render the durability bar in the GUI.
|
boolean |
getShareTag() |
float |
getSmeltingExperience(ItemStack item)
Determines the base experience for a player when they remove this item from a furnace slot.
|
void |
getSubItems(CreativeTabs tab,
NonNullList<ItemStack> items) |
TileEntityItemStackRenderer |
getTileEntityItemStackRenderer() |
java.util.Set<java.lang.String> |
getToolClasses(ItemStack stack) |
java.lang.String |
getUnlocalizedName() |
java.lang.String |
getUnlocalizedName(ItemStack stack) |
java.lang.String |
getUnlocalizedNameInefficiently(ItemStack stack) |
float |
getXpRepairRatio(ItemStack stack)
Determines the amount of durability the mending enchantment
will repair, on average, per point of experience.
|
boolean |
hasContainerItem()
Deprecated.
|
boolean |
hasContainerItem(ItemStack stack)
ItemStack sensitive version of hasContainerItem
|
boolean |
hasCustomEntity(ItemStack stack)
Determines if this Item has a special entity for when they are in the world.
|
boolean |
hasCustomProperties() |
boolean |
hasEffect(ItemStack stack) |
boolean |
hitEntity(ItemStack stack,
EntityLivingBase target,
EntityLivingBase attacker) |
ICapabilityProvider |
initCapabilities(ItemStack stack,
NBTTagCompound nbt)
Called from ItemStack.setItem, will hold extra data for the life of this ItemStack.
|
boolean |
isBeaconPayment(ItemStack stack)
Whether this Item can be used as a payment to activate the vanilla beacon.
|
boolean |
isBookEnchantable(ItemStack stack,
ItemStack book)
Allow or forbid the specific book/item combination as an anvil enchant
|
boolean |
isDamageable() |
boolean |
isDamaged(ItemStack stack)
Return if this itemstack is damaged.
|
boolean |
isEnchantable(ItemStack stack) |
boolean |
isFull3D() |
protected boolean |
isInCreativeTab(CreativeTabs targetTab) |
boolean |
isMap() |
boolean |
isRepairable()
Called by CraftingManager to determine if an item is reparable.
|
boolean |
isShield(ItemStack stack,
EntityLivingBase entity)
Is this Item a shield
|
boolean |
isValidArmor(ItemStack stack,
EntityEquipmentSlot armorType,
Entity entity)
Determines if the specific ItemStack can be placed in the specified armor slot, for the entity.
|
boolean |
itemInteractionForEntity(ItemStack stack,
EntityPlayer playerIn,
EntityLivingBase target,
EnumHand hand) |
void |
onArmorTick(World world,
EntityPlayer player,
ItemStack itemStack)
Called to tick armor in the armor slot.
|
boolean |
onBlockDestroyed(ItemStack stack,
World worldIn,
IBlockState state,
BlockPos pos,
EntityLivingBase entityLiving) |
boolean |
onBlockStartBreak(ItemStack itemstack,
BlockPos pos,
EntityPlayer player)
Called before a block is broken.
|
void |
onCreated(ItemStack stack,
World worldIn,
EntityPlayer playerIn) |
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
|
boolean |
onEntityItemUpdate(EntityItem entityItem)
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.
|
boolean |
onEntitySwing(EntityLivingBase entityLiving,
ItemStack stack)
Called when a entity tries to play the 'swing' animation.
|
void |
onHorseArmorTick(World world,
EntityLiving horse,
ItemStack armor)
Called every tick from
EntityHorse#onUpdate() on the item in the armor slot. |
ActionResult<ItemStack> |
onItemRightClick(World worldIn,
EntityPlayer playerIn,
EnumHand handIn) |
EnumActionResult |
onItemUse(EntityPlayer player,
World worldIn,
BlockPos pos,
EnumHand hand,
EnumFacing facing,
float hitX,
float hitY,
float hitZ) |
ItemStack |
onItemUseFinish(ItemStack stack,
World worldIn,
EntityLivingBase entityLiving) |
EnumActionResult |
onItemUseFirst(EntityPlayer player,
World world,
BlockPos pos,
EnumFacing side,
float hitX,
float hitY,
float hitZ,
EnumHand hand)
This is called when the item is used, before the block is activated.
|
boolean |
onLeftClickEntity(ItemStack stack,
EntityPlayer player,
Entity entity)
Called when the player Left Clicks (attacks) an entity.
|
void |
onPlayerStoppedUsing(ItemStack stack,
World worldIn,
EntityLivingBase entityLiving,
int timeLeft) |
void |
onUpdate(ItemStack stack,
World worldIn,
Entity entityIn,
int itemSlot,
boolean isSelected) |
void |
onUsingTick(ItemStack stack,
EntityLivingBase player,
int count)
Called each tick while using an item.
|
protected RayTraceResult |
rayTrace(World worldIn,
EntityPlayer playerIn,
boolean useLiquids) |
void |
readNBTShareTag(ItemStack stack,
NBTTagCompound nbt)
Override this method to decide what to do with the NBT data received from getNBTShareTag().
|
private static void |
registerItem(int id,
ResourceLocation textualID,
Item itemIn) |
private static void |
registerItem(int id,
java.lang.String textualID,
Item itemIn) |
private static void |
registerItemBlock(Block blockIn) |
protected static void |
registerItemBlock(Block blockIn,
Item itemIn) |
static void |
registerItems() |
void |
renderHelmetOverlay(ItemStack stack,
EntityPlayer player,
ScaledResolution resolution,
float partialTicks)
Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet.
|
Item |
setContainerItem(Item containerItem) |
Item |
setCreativeTab(CreativeTabs tab) |
void |
setDamage(ItemStack stack,
int damage)
Set the damage for this itemstack.
|
Item |
setFull3D() |
void |
setHarvestLevel(java.lang.String toolClass,
int level)
Sets or removes the harvest level for the specified tool class.
|
Item |
setHasSubtypes(boolean hasSubtypes) |
Item |
setMaxDamage(int maxDamageIn) |
Item |
setMaxStackSize(int maxStackSize) |
Item |
setNoRepair()
Call to disable repair recipes.
|
void |
setTileEntityItemStackRenderer(TileEntityItemStackRenderer teisr) |
Item |
setUnlocalizedName(java.lang.String unlocalizedName) |
boolean |
shouldCauseBlockBreakReset(ItemStack oldStack,
ItemStack newStack)
Called when the player is mining a block and the item in his hand changes.
|
boolean |
shouldCauseReequipAnimation(ItemStack oldStack,
ItemStack newStack,
boolean slotChanged)
Determine if the player switching between these two item stacks
|
boolean |
shouldRotateAroundWhenRendering() |
boolean |
showDurabilityBar(ItemStack stack)
Determines if the durability bar should be rendered for this item.
|
boolean |
updateItemStackNBT(NBTTagCompound nbt) |
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
public static final RegistryNamespaced<ResourceLocation,Item> REGISTRY
private static final IItemPropertyGetter DAMAGED_GETTER
private static final IItemPropertyGetter DAMAGE_GETTER
private static final IItemPropertyGetter LEFTHANDED_GETTER
private static final IItemPropertyGetter COOLDOWN_GETTER
private final IRegistry<ResourceLocation,IItemPropertyGetter> properties
protected static final java.util.UUID ATTACK_DAMAGE_MODIFIER
protected static final java.util.UUID ATTACK_SPEED_MODIFIER
private CreativeTabs tabToDisplayOn
protected static java.util.Random itemRand
protected int maxStackSize
private int maxDamage
protected boolean bFull3D
protected boolean hasSubtypes
private Item containerItem
private java.lang.String unlocalizedName
protected boolean canRepair
private java.util.Map<java.lang.String,java.lang.Integer> toolClasses
@Nullable private TileEntityItemStackRenderer teisr
public static int getIdFromItem(Item itemIn)
public static Item getItemById(int id)
@Nullable public static Item getByNameOrId(java.lang.String id)
public final void addPropertyOverride(ResourceLocation key, IItemPropertyGetter getter)
@Nullable public IItemPropertyGetter getPropertyGetter(ResourceLocation key)
public boolean updateItemStackNBT(NBTTagCompound nbt)
public boolean hasCustomProperties()
public Item setMaxStackSize(int maxStackSize)
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
public float getDestroySpeed(ItemStack stack, IBlockState state)
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving)
@Deprecated public int getItemStackLimit()
public int getMetadata(int damage)
public boolean getHasSubtypes()
public Item setHasSubtypes(boolean hasSubtypes)
@Deprecated public int getMaxDamage()
public Item setMaxDamage(int maxDamageIn)
public boolean isDamageable()
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
public boolean canHarvestBlock(IBlockState blockIn)
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
public Item setFull3D()
public boolean isFull3D()
public boolean shouldRotateAroundWhenRendering()
public Item setUnlocalizedName(java.lang.String unlocalizedName)
public java.lang.String getUnlocalizedNameInefficiently(ItemStack stack)
public java.lang.String getUnlocalizedName()
public java.lang.String getUnlocalizedName(ItemStack stack)
public boolean getShareTag()
@Nullable public Item getContainerItem()
@Deprecated public boolean hasContainerItem()
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn)
public boolean isMap()
public EnumAction getItemUseAction(ItemStack stack)
public int getMaxItemUseDuration(ItemStack stack)
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
public void addInformation(ItemStack stack, @Nullable World worldIn, java.util.List<java.lang.String> tooltip, ITooltipFlag flagIn)
public java.lang.String getItemStackDisplayName(ItemStack stack)
public boolean hasEffect(ItemStack stack)
@Deprecated public EnumRarity getRarity(ItemStack stack)
public boolean isEnchantable(ItemStack stack)
protected RayTraceResult rayTrace(World worldIn, EntityPlayer playerIn, boolean useLiquids)
public int getItemEnchantability()
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
protected boolean isInCreativeTab(CreativeTabs targetTab)
@Nullable public CreativeTabs getCreativeTab()
public Item setCreativeTab(CreativeTabs tab)
public boolean canItemEditBlocks()
@Deprecated public com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
public com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
player
- The player that dropped the itemitem
- The item stack, before the item is removed.public 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.public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
stack
- The Item Stackplayer
- The Player that used the itemworld
- The Current Worldpos
- Target positionside
- The side of the target hithand
- Which hand the item is being held in.public boolean isRepairable()
public Item setNoRepair()
public float getXpRepairRatio(ItemStack stack)
@Nullable public NBTTagCompound getNBTShareTag(ItemStack stack)
stack
- The stack to send the NBT tag forpublic void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
stack
- The stack that received NBTnbt
- Received NBT, can be nullpublic boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
itemstack
- The current ItemStackpos
- Block's position in worldplayer
- The Player that is wielding the itempublic 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 continuouslypublic boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
stack
- The Item being usedplayer
- The player that is attackingentity
- The entity being attackedpublic ItemStack getContainerItem(ItemStack itemStack)
itemStack
- The current ItemStackpublic boolean hasContainerItem(ItemStack stack)
stack
- The current item stackpublic int getEntityLifespan(ItemStack itemStack, World world)
itemStack
- The current ItemStackworld
- The world the entity is inpublic boolean hasCustomEntity(ItemStack stack)
stack
- The current item stack@Nullable public 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 stackpublic boolean onEntityItemUpdate(EntityItem entityItem)
entityItem
- The entity Itempublic CreativeTabs[] getCreativeTabs()
public float getSmeltingExperience(ItemStack item)
item
- The item stack the player is picking up.public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player)
world
- The worldpos
- Block position in worldplayer
- The Player that is wielding the itempublic void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity)
stack
- The ItemStackarmorType
- Armor slot to be verified.entity
- The entity trying to equip the armor@Nullable public EntityEquipmentSlot getEquipmentSlot(ItemStack stack)
EntityLiving.getSlotForItemStack(ItemStack)
.stack
- the ItemStacknull
to let the default
vanilla logic as per EntityLiving.getSlotForItemStack(stack)
decidepublic boolean isBookEnchantable(ItemStack stack, ItemStack book)
stack
- The itembook
- The book@Nullable public 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 public FontRenderer getFontRenderer(ItemStack stack)
stack
- The current item stack@Nullable public 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.public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack)
entityLiving
- The entity swinging the item.stack
- The Item stackpublic void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, 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 interpolationpublic int getDamage(ItemStack stack)
stack
- The itemstack that is damagedpublic int getMetadata(ItemStack stack)
stack
- public boolean showDurabilityBar(ItemStack stack)
stack
- The current Item Stackpublic double getDurabilityForDisplay(ItemStack stack)
stack
- The current ItemStackpublic int getRGBDurabilityForDisplay(ItemStack stack)
getDurabilityForDisplay(net.minecraft.item.ItemStack)
, but can be overriden.stack
- Stack to get durability frompublic int getMaxDamage(ItemStack stack)
stack
- The itemstack that is damagedpublic boolean isDamaged(ItemStack stack)
isDamageable()
is true.stack
- the stackpublic void setDamage(ItemStack stack, int damage)
stack
- the stackdamage
- the new damage valuepublic boolean canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player)
PlayerControllerMP.onPlayerDestroyBlock()
when a creative player left-clicks a block with this item.
Also checked from ForgeHooks.onBlockBreakEvent()
to prevent sending an event.public boolean canHarvestBlock(IBlockState state, ItemStack stack)
canHarvestBlock(IBlockState)
state
- The block trying to harveststack
- The itemstack used to harvest the blockpublic int getItemStackLimit(ItemStack stack)
stack
- The ItemStackpublic void setHarvestLevel(java.lang.String toolClass, int level)
toolClass
- Classlevel
- Harvest level:
Wood: 0
Stone: 1
Iron: 2
Diamond: 3
Gold: 0public java.util.Set<java.lang.String> getToolClasses(ItemStack stack)
public int getHarvestLevel(ItemStack stack, java.lang.String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState)
stack
- This item stack instancetoolClass
- Tool Classplayer
- The player trying to harvest the given blockstateblockState
- The block to harvestpublic int getItemEnchantability(ItemStack stack)
stack
- The ItemStackpublic 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 appliedpublic boolean isBeaconPayment(ItemStack stack)
stack
- the ItemStackpublic 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.public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack)
oldStack
- The old stack that was used for mining. Item in players main handnewStack
- The new stackpublic boolean canContinueUsing(ItemStack oldStack, ItemStack newStack)
oldStack
- the previous 'active' stacknewStack
- the stack currently in the active hand@Nullable public java.lang.String getCreatorModId(ItemStack itemStack)
itemStack
- the ItemStack to checkIForgeRegistryEntry.Impl.getRegistryName()
would return null.@Nullable public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt)
stack
- The ItemStacknbt
- NBT of this item serialized, or null.public com.google.common.collect.ImmutableMap<java.lang.String,ITimeValue> getAnimationParameters(ItemStack stack, World world, EntityLivingBase entity)
public 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 ItemStackpublic boolean isShield(ItemStack stack, @Nullable EntityLivingBase entity)
stack
- The ItemStackentity
- The Entity holding the ItemStackpublic int getItemBurnTime(ItemStack itemStack)
public 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 armorpublic java.lang.String getHorseArmorTexture(EntityLiving wearer, ItemStack stack)
public void onHorseArmorTick(World world, EntityLiving horse, ItemStack armor)
EntityHorse#onUpdate()
on the item in the armor slot.world
- the world the horse is inhorse
- the horse wearing this armorarmor
- the armor itemstackpublic final TileEntityItemStackRenderer getTileEntityItemStackRenderer()
public void setTileEntityItemStackRenderer(@Nullable TileEntityItemStackRenderer teisr)
public static void registerItems()
private static void registerItemBlock(Block blockIn)
private static void registerItem(int id, java.lang.String textualID, Item itemIn)
private static void registerItem(int id, ResourceLocation textualID, Item itemIn)
public ItemStack getDefaultInstance()