public class Item
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Item.ToolMaterial |
Modifier and Type | Field and Description |
---|---|
protected boolean |
bFull3D |
protected boolean |
canRepair |
RegistryDelegate<Item> |
delegate |
protected static java.util.UUID |
field_111210_e |
protected boolean |
hasSubtypes |
protected java.lang.String |
iconString |
protected IIcon |
itemIcon |
protected static java.util.Random |
itemRand |
static RegistryNamespaced |
itemRegistry |
protected int |
maxStackSize |
Constructor and Description |
---|
Item() |
Modifier and Type | Method and Description |
---|---|
void |
addInformation(ItemStack p_77624_1_,
EntityPlayer p_77624_2_,
java.util.List p_77624_3_,
boolean p_77624_4_) |
boolean |
canHarvestBlock(Block par1Block,
ItemStack itemStack)
ItemStack sensitive version of
#canHarvestBlock(Block) |
boolean |
canItemEditBlocks() |
Entity |
createEntity(World world,
Entity location,
ItemStack itemstack)
This function should return a new entity to replace the dropped item.
|
boolean |
doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) |
boolean |
doesSneakBypassUse(World world,
int x,
int y,
int z,
EntityPlayer player)
Should this item, when held, allow sneak-clicks to pass through to the underlying block?
|
float |
func_150893_a(ItemStack p_150893_1_,
Block p_150893_2_) |
boolean |
func_150897_b(Block p_150897_1_) |
ModelBiped |
getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack,
int armorSlot)
Override this method to have an item handle its own armor rendering.
|
java.lang.String |
getArmorTexture(ItemStack stack,
Entity entity,
int slot,
java.lang.String type)
Called by RenderBiped and RenderPlayer to determine the armor texture that
should be use for the currently equiped item.
|
com.google.common.collect.Multimap |
getAttributeModifiers(ItemStack stack)
ItemStack sensitive version of getItemAttributeModifiers
|
WeightedRandomChestContent |
getChestGenBase(ChestGenHooks chest,
java.util.Random rnd,
WeightedRandomChestContent original)
Generates the base Random item for a specific instance of the chest gen,
Enchanted books use this to pick a random enchantment.
|
int |
getColorFromItemStack(ItemStack p_82790_1_,
int p_82790_2_) |
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.
|
int |
getDamage(ItemStack stack)
Return the itemDamage represented by this ItemStack.
|
float |
getDigSpeed(ItemStack itemstack,
Block block,
int metadata)
Metadata-sensitive version of getStrVsBlock
|
int |
getDisplayDamage(ItemStack stack)
Deprecated.
|
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.
|
FontRenderer |
getFontRenderer(ItemStack stack)
Returns the font renderer used to render tooltips and overlays for this item.
|
int |
getHarvestLevel(ItemStack stack,
java.lang.String toolClass)
Queries the harvest level of this item stack for the specifred tool class,
Returns -1 if this tool is not of the specified type
|
boolean |
getHasSubtypes() |
IIcon |
getIcon(ItemStack stack,
int pass)
Return the correct icon for rendering based on the supplied ItemStack and render pass.
|
IIcon |
getIcon(ItemStack stack,
int renderPass,
EntityPlayer player,
ItemStack usingItem,
int useRemaining)
Player, Render pass, and item usage sensitive version of getIconIndex.
|
IIcon |
getIconFromDamage(int p_77617_1_) |
IIcon |
getIconFromDamageForRenderPass(int p_77618_1_,
int p_77618_2_) |
IIcon |
getIconIndex(ItemStack p_77650_1_) |
protected java.lang.String |
getIconString() |
static int |
getIdFromItem(Item p_150891_0_) |
boolean |
getIsRepairable(ItemStack p_82789_1_,
ItemStack p_82789_2_) |
com.google.common.collect.Multimap |
getItemAttributeModifiers()
Deprecated.
|
static Item |
getItemById(int p_150899_0_) |
int |
getItemEnchantability() |
int |
getItemEnchantability(ItemStack stack)
ItemStack sensitive version of getItemEnchantability
|
static Item |
getItemFromBlock(Block p_150898_0_) |
java.lang.String |
getItemStackDisplayName(ItemStack p_77653_1_) |
int |
getItemStackLimit()
Deprecated.
|
int |
getItemStackLimit(ItemStack stack)
Gets the maximum number of items that this stack should be able to hold.
|
EnumAction |
getItemUseAction(ItemStack p_77661_1_) |
int |
getMaxDamage() |
int |
getMaxDamage(ItemStack stack)
Return the maxDamage for this ItemStack.
|
int |
getMaxItemUseDuration(ItemStack p_77626_1_) |
int |
getMetadata(int p_77647_1_) |
protected MovingObjectPosition |
getMovingObjectPositionFromPlayer(World p_77621_1_,
EntityPlayer p_77621_2_,
boolean p_77621_3_) |
java.lang.String |
getPotionEffect(ItemStack p_150896_1_) |
EnumRarity |
getRarity(ItemStack p_77613_1_) |
int |
getRenderPasses(int metadata)
Returns the number of render passes/layers this item has.
|
boolean |
getShareTag() |
float |
getSmeltingExperience(ItemStack item)
Determines the base experience for a player when they remove this item from a furnace slot.
|
int |
getSpriteNumber() |
void |
getSubItems(Item p_150895_1_,
CreativeTabs p_150895_2_,
java.util.List p_150895_3_) |
java.util.Set<java.lang.String> |
getToolClasses(ItemStack stack) |
java.lang.String |
getUnlocalizedName() |
java.lang.String |
getUnlocalizedName(ItemStack p_77667_1_) |
java.lang.String |
getUnlocalizedNameInefficiently(ItemStack p_77657_1_) |
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 |
hasEffect(ItemStack p_77636_1_)
Deprecated.
|
boolean |
hasEffect(ItemStack par1ItemStack,
int pass)
Render Pass sensitive version of hasEffect()
|
boolean |
hitEntity(ItemStack p_77644_1_,
EntityLivingBase p_77644_2_,
EntityLivingBase p_77644_3_) |
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 |
isFull3D() |
boolean |
isItemTool(ItemStack p_77616_1_) |
boolean |
isMap() |
boolean |
isPotionIngredient(ItemStack p_150892_1_) |
boolean |
isRepairable()
Called by CraftingManager to determine if an item is reparable.
|
boolean |
isValidArmor(ItemStack stack,
int armorType,
Entity entity)
Determines if the specific ItemStack can be placed in the specified armor slot.
|
boolean |
itemInteractionForEntity(ItemStack p_111207_1_,
EntityPlayer p_111207_2_,
EntityLivingBase p_111207_3_) |
void |
onArmorTick(World world,
EntityPlayer player,
ItemStack itemStack)
Called to tick armor in the armor slot.
|
boolean |
onBlockDestroyed(ItemStack p_150894_1_,
World p_150894_2_,
Block p_150894_3_,
int p_150894_4_,
int p_150894_5_,
int p_150894_6_,
EntityLivingBase p_150894_7_) |
boolean |
onBlockStartBreak(ItemStack itemstack,
int X,
int Y,
int Z,
EntityPlayer player)
Called before a block is broken.
|
void |
onCreated(ItemStack p_77622_1_,
World p_77622_2_,
EntityPlayer p_77622_3_) |
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
|
ItemStack |
onEaten(ItemStack p_77654_1_,
World p_77654_2_,
EntityPlayer p_77654_3_) |
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.
|
ItemStack |
onItemRightClick(ItemStack p_77659_1_,
World p_77659_2_,
EntityPlayer p_77659_3_) |
boolean |
onItemUse(ItemStack p_77648_1_,
EntityPlayer p_77648_2_,
World p_77648_3_,
int p_77648_4_,
int p_77648_5_,
int p_77648_6_,
int p_77648_7_,
float p_77648_8_,
float p_77648_9_,
float p_77648_10_) |
boolean |
onItemUseFirst(ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ)
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 p_77615_1_,
World p_77615_2_,
EntityPlayer p_77615_3_,
int p_77615_4_) |
void |
onUpdate(ItemStack p_77663_1_,
World p_77663_2_,
Entity p_77663_3_,
int p_77663_4_,
boolean p_77663_5_) |
void |
onUsingTick(ItemStack stack,
EntityPlayer player,
int count)
Called each tick while using an item.
|
void |
registerIcons(IIconRegister p_94581_1_) |
static void |
registerItems() |
void |
renderHelmetOverlay(ItemStack stack,
EntityPlayer player,
ScaledResolution resolution,
float partialTicks,
boolean hasScreen,
int mouseX,
int mouseY)
Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet.
|
boolean |
requiresMultipleRenderPasses() |
Item |
setContainerItem(Item p_77642_1_) |
Item |
setCreativeTab(CreativeTabs p_77637_1_) |
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 p_77627_1_) |
Item |
setMaxDamage(int p_77656_1_) |
Item |
setMaxStackSize(int p_77625_1_) |
Item |
setNoRepair()
Call to disable repair recipes.
|
Item |
setPotionEffect(java.lang.String p_77631_1_) |
Item |
setTextureName(java.lang.String p_111206_1_) |
Item |
setUnlocalizedName(java.lang.String p_77655_1_) |
boolean |
shouldRotateAroundWhenRendering() |
boolean |
showDurabilityBar(ItemStack stack)
Determines if the durability bar should be rendered for this item.
|
public static final RegistryNamespaced itemRegistry
protected static final java.util.UUID field_111210_e
protected static java.util.Random itemRand
protected int maxStackSize
protected boolean bFull3D
protected boolean hasSubtypes
protected IIcon itemIcon
protected java.lang.String iconString
public final RegistryDelegate<Item> delegate
protected boolean canRepair
public static int getIdFromItem(Item p_150891_0_)
public static Item getItemById(int p_150899_0_)
public static void registerItems()
public Item setMaxStackSize(int p_77625_1_)
public int getSpriteNumber()
public IIcon getIconFromDamage(int p_77617_1_)
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)
@Deprecated public int getItemStackLimit()
public int getMetadata(int p_77647_1_)
public boolean getHasSubtypes()
public Item setHasSubtypes(boolean p_77627_1_)
public int getMaxDamage()
public Item setMaxDamage(int p_77656_1_)
public boolean isDamageable()
public boolean hitEntity(ItemStack p_77644_1_, EntityLivingBase p_77644_2_, EntityLivingBase p_77644_3_)
public boolean onBlockDestroyed(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_)
public boolean func_150897_b(Block p_150897_1_)
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
public Item setFull3D()
public boolean isFull3D()
public boolean shouldRotateAroundWhenRendering()
public Item setUnlocalizedName(java.lang.String p_77655_1_)
public java.lang.String getUnlocalizedNameInefficiently(ItemStack p_77657_1_)
public java.lang.String getUnlocalizedName()
public java.lang.String getUnlocalizedName(ItemStack p_77667_1_)
public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_)
public boolean getShareTag()
public Item getContainerItem()
@Deprecated public boolean hasContainerItem()
public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_)
public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_)
public void onCreated(ItemStack p_77622_1_, World p_77622_2_, EntityPlayer p_77622_3_)
public boolean isMap()
public EnumAction getItemUseAction(ItemStack p_77661_1_)
public int getMaxItemUseDuration(ItemStack p_77626_1_)
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_)
public Item setPotionEffect(java.lang.String p_77631_1_)
public java.lang.String getPotionEffect(ItemStack p_150896_1_)
public boolean isPotionIngredient(ItemStack p_150892_1_)
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, java.util.List p_77624_3_, boolean p_77624_4_)
public java.lang.String getItemStackDisplayName(ItemStack p_77653_1_)
@Deprecated public boolean hasEffect(ItemStack p_77636_1_)
public EnumRarity getRarity(ItemStack p_77613_1_)
public boolean isItemTool(ItemStack p_77616_1_)
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_)
public int getItemEnchantability()
public boolean requiresMultipleRenderPasses()
public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_)
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, java.util.List p_150895_3_)
public Item setCreativeTab(CreativeTabs p_77637_1_)
public CreativeTabs getCreativeTab()
public boolean canItemEditBlocks()
public void registerIcons(IIconRegister p_94581_1_)
@Deprecated public com.google.common.collect.Multimap getItemAttributeModifiers()
public Item setTextureName(java.lang.String p_111206_1_)
protected java.lang.String getIconString()
public com.google.common.collect.Multimap getAttributeModifiers(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 boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
stack
- The Item Stackplayer
- The Player that used the itemworld
- The Current Worldx
- Target X Positiony
- Target Y Positionz
- Target Z Positionside
- The side of the target hitpublic float getDigSpeed(ItemStack itemstack, Block block, int metadata)
itemstack
- The Item Stackblock
- The block the item is trying to breakmetadata
- The items current metadatapublic boolean isRepairable()
public Item setNoRepair()
public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
itemstack
- The current ItemStackX
- The X PositionY
- The X PositionZ
- The X Positionplayer
- The Player that is wielding the itempublic void onUsingTick(ItemStack stack, EntityPlayer 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 IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
stack
- The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null)renderPass
- The pass to get the icon for, 0 is default.player
- The player holding the itemusingItem
- The item the player is actively using. Can be null if not using anything.useRemaining
- The ticks remaining for the active item.public int getRenderPasses(int metadata)
metadata
- The item's metadatapublic 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 stackpublic 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 IIcon getIcon(ItemStack stack, int pass)
getIconFromDamageForRenderPass(int, int)
stack
- to render forpass
- the multi-render passpublic WeightedRandomChestContent getChestGenBase(ChestGenHooks chest, java.util.Random rnd, WeightedRandomChestContent original)
chest
- The chest category to generate forrnd
- World RNGoriginal
- Original result registered with the chest gen hooks.public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
world
- The worldx
- The X Positiony
- The X Positionz
- The X Positionplayer
- The Player that is wielding the itempublic void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
world
- player
- itemStack
- public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
stack
- The ItemStackarmorType
- Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Bootsentity
- The entity trying to equip the armorpublic boolean isBookEnchantable(ItemStack stack, ItemStack book)
stack
- The itembook
- The bookpublic java.lang.String getArmorTexture(ItemStack stack, Entity entity, int slot, java.lang.String type)
stack
- ItemStack for the equpt armorentity
- The entity wearing the armorslot
- The slot the armor is intype
- The subtype, can be null or "overlay"public FontRenderer getFontRenderer(ItemStack stack)
stack
- The current item stackpublic ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
entityLiving
- The entity wearing the armoritemStack
- The itemStack to render the model ofarmorSlot
- 0=head, 1=torso, 2=legs, 3=feetpublic 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, boolean hasScreen, int mouseX, int mouseY)
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 interpolationhasScreen
- If the player has a screen up, which will be rendered after this.mouseX
- Mouse's X position on screenmouseY
- Mouse's Y position on screenpublic int getDamage(ItemStack stack)
stack
- The itemstack that is damaged@Deprecated public int getDisplayDamage(ItemStack stack)
public boolean showDurabilityBar(ItemStack stack)
stack
- The current Item Stackpublic double getDurabilityForDisplay(ItemStack stack)
stack
- The current ItemStackpublic 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 canHarvestBlock(Block par1Block, ItemStack itemStack)
#canHarvestBlock(Block)
par1Block
- The block trying to harvestitemStack
- The itemstack used to harvest the blockpublic boolean hasEffect(ItemStack par1ItemStack, int pass)
public 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)
stack
- This item stack instancetoolClass
- Tool Classpublic int getItemEnchantability(ItemStack stack)
stack
- The ItemStackpublic boolean isBeaconPayment(ItemStack stack)
stack
- the ItemStack