Package net.minecraft.item
Class Item
- java.lang.Object
-
- net.zxmushroom63.plugins.BaseData
-
- net.zxmushroom63.plugins.PluginData
-
- net.minecraft.item.Item
-
- All Implemented Interfaces:
org.teavm.jso.JSObject
- Direct Known Subclasses:
ItemArmor,ItemArmorStand,ItemBed,ItemBlock,ItemBoat,ItemBook,ItemBow,ItemBucket,ItemBucketMilk,ItemCarrotOnAStick,ItemCoal,ItemDoor,ItemDye,ItemEditableBook,ItemEgg,ItemEnchantedBook,ItemEnderEye,ItemEnderPearl,ItemExpBottle,ItemFireball,ItemFirework,ItemFireworkCharge,ItemFishingRod,ItemFlintAndSteel,ItemFood,ItemGlassBottle,ItemHangingEntity,ItemHoe,ItemLead,ItemMapBase,ItemMinecart,ItemMonsterPlacer,ItemNameTag,ItemPotion,ItemRecord,ItemRedstone,ItemReed,ItemSaddle,ItemSeeds,ItemShears,ItemSign,ItemSimpleFoiled,ItemSkull,ItemSnowball,ItemSword,ItemTool,ItemWritableBook
public class Item extends PluginData
+ This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team EaglercraftX 1.8 patch files are (c) 2022-2023 LAX1DUDE. All Rights Reserved. WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR. NOT FOR COMMERCIAL OR MALICIOUS USE (please read the 'LICENSE' file this repo's root directory for more info)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classItem.ToolMaterial-
Nested classes/interfaces inherited from class net.zxmushroom63.plugins.BaseData
BaseData.BooleanCallback, BaseData.BooleanCallbackArr, BaseData.DataBooleanCallback, BaseData.DataBooleanCallbackArr, BaseData.DataDoubleCallback, BaseData.DataDoubleCallbackArr, BaseData.DataFloatCallback, BaseData.DataFloatCallbackArr, BaseData.DataIntCallback, BaseData.DataIntCallbackArr, BaseData.DataObjectCallback, BaseData.DataObjectCallbackArr, BaseData.DataStringCallback, BaseData.DataStringCallbackArr, BaseData.DataVoidCallback, BaseData.DoubleCallback, BaseData.DoubleCallbackArr, BaseData.FloatCallback, BaseData.FloatCallbackArr, BaseData.IntCallback, BaseData.IntCallbackArr, BaseData.ObjectCallback, BaseData.ObjectCallbackArr, BaseData.StringCallback, BaseData.StringCallbackArr, BaseData.VoidCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbFull3Dprotected booleanhasSubtypesprotected static EaglercraftUUIDitemModifierUUIDprotected static EaglercraftRandomitemRand+ The RNG used by the Item subclasses.static RegistryNamespaced<ResourceLocation,Item>itemRegistryprotected intmaxStackSize+ Maximum size of the stack.
-
Constructor Summary
Constructors Constructor Description Item()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInformation(ItemStack var1, EntityPlayer var2, java.util.List<java.lang.String> var3, boolean var4)+ allows items to add custom lines of information to the mouseover descriptionbooleancanHarvestBlock(Block var1)+ Check whether this Item can harvest the given BlockbooleancanItemEditBlocks()+ Returns true if players can use this item to affect the world (e.g.static ItemgetByNameOrId(java.lang.String id)+ Tries to get an Item by it's name (e.g.intgetColorFromItemStack(ItemStack var1, int var2)ItemgetContainerItem()CreativeTabsgetCreativeTab()+ gets the CreativeTab this item is displayed onbooleangetHasSubtypes()static intgetIdFromItem(Item itemIn)booleangetIsRepairable(ItemStack var1, ItemStack var2)+ Return whether this item is repairable in an anvil.Multimap<java.lang.String,AttributeModifier>getItemAttributeModifiers()static ItemgetItemById(int id)intgetItemEnchantability()+ Return the enchantability factor of the item, most of the time is based on material.static ItemgetItemFromBlock(Block blockIn)java.lang.StringgetItemStackDisplayName(ItemStack itemstack)intgetItemStackLimit()+ Returns the maximum size of the stack for a specific item.EnumActiongetItemUseAction(ItemStack var1)+ returns the action that specifies what animation to play when the items is being usedintgetMaxDamage()+ Returns the maximum damage an item can take.intgetMaxItemUseDuration(ItemStack var1)+ How long it takes to use or consume an itemintgetMetadata(int var1)+ Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is placed as a Block (mostly used with ItemBlocks).protected MovingObjectPositiongetMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)java.lang.StringgetPotionEffect(ItemStack var1)EnumRaritygetRarity(ItemStack itemstack)+ Return an item rarity from EnumRaritybooleangetShareTag()+ If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.floatgetStrVsBlock(ItemStack var1, Block var2)voidgetSubItems(Item item, CreativeTabs var2, java.util.List<ItemStack> list)+ returns a list of items with the same ID, but different meta (eg: dye returns 16 items)java.lang.StringgetUnlocalizedName()+ Returns the unlocalized name of this item.java.lang.StringgetUnlocalizedName(ItemStack var1)+ Returns the unlocalized name of this item.java.lang.StringgetUnlocalizedNameInefficiently(ItemStack stack)+ Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the unlocalized name itself is returned.booleanhasContainerItem()+ True if this Item has a container item (a.k.a.booleanhasEffect(ItemStack itemstack)booleanhitEntity(ItemStack var1, EntityLivingBase var2, EntityLivingBase var3)+ Current implementations of this method in child classes do not use the entry argument beside ev.booleanisDamageable()booleanisFull3D()+ Returns True is the item is renderer in full 3D when hold.booleanisItemTool(ItemStack var1)+ Checks isDamagable and if it cannot be stackedbooleanisMap()+ false for all Items except sub-classes of ItemMapBasebooleanisPotionIngredient(ItemStack stack)booleanitemInteractionForEntity(ItemStack var1, EntityPlayer var2, EntityLivingBase var3)+ Returns true if the item can be used on the given entity, e.g.voidloadPluginData(BaseData data)PluginDatamakePluginData()booleanonBlockDestroyed(ItemStack var1, World var2, Block var3, BlockPos var4, EntityLivingBase var5)+ Called when a Block is destroyed using this Item.voidonCreated(ItemStack var1, World var2, EntityPlayer var3)+ Called when item is crafted/smelted.ItemStackonItemRightClick(ItemStack itemstack, World var2, EntityPlayer var3)+ Called whenever this item is equipped and the right mouse button is pressed.booleanonItemUse(ItemStack var1, EntityPlayer var2, World var3, BlockPos var4, EnumFacing var5, float var6, float var7, float var8)+ Called when a Block is right-clicked with this ItemItemStackonItemUseFinish(ItemStack itemstack, World var2, EntityPlayer var3)+ Called when the player finishes using this Item (E.g.voidonPlayerStoppedUsing(ItemStack var1, World var2, EntityPlayer var3, int var4)+ Called when the player stops using an Item (stops holding the right mouse button).voidonUpdate(ItemStack var1, World var2, Entity var3, int var4, boolean var5)+ Called each tick as long the item is on a player inventory.protected static voidregisterItemBlock(Block blockIn, Item itemIn)+ Register the given Item as the ItemBlock for the given Block.static voidregisterItems()ItemsetContainerItem(Item containerItem)ItemsetCreativeTab(CreativeTabs tab)+ returns this;ItemsetFull3D()+ Sets bFull3D to True and return the object.protected ItemsetHasSubtypes(boolean hasSubtypes)protected ItemsetMaxDamage(int maxDamageIn)+ set max damage of an ItemItemsetMaxStackSize(int maxStackSize)protected ItemsetPotionEffect(java.lang.String potionEffect)+ Sets the string representing this item's effect on a potion when used as an ingredient.ItemsetUnlocalizedName(java.lang.String s)+ Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."booleanshouldRotateAroundWhenRendering()+ Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities hands.booleanupdateItemStackNBT(NBTTagCompound var1)+ Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data-
Methods inherited from class net.zxmushroom63.plugins.BaseData
execFuncBaseData, execFuncObject, execFuncString, getBaseData, getBaseDataArr, getBoolean, getBooleanArr, getByte, getByteArr, getChar, getCharArr, getDouble, getDoubleArr, getFloat, getFloatArr, getInt, getIntArr, getObject, getObjectArr, getShort, getShortArr, getString, getStringArr, has, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setCallbackBoolean, setCallbackBooleanArr, setCallbackBooleanArrWithDataArg, setCallbackBooleanWithDataArg, setCallbackDouble, setCallbackDoubleArr, setCallbackDoubleArrWithDataArg, setCallbackDoubleWithDataArg, setCallbackFloat, setCallbackFloatArr, setCallbackFloatArrWithDataArg, setCallbackFloatWithDataArg, setCallbackInt, setCallbackIntArr, setCallbackIntArrWithDataArg, setCallbackIntWithDataArg, setCallbackObject, setCallbackObjectArr, setCallbackObjectArrWithDataArg, setCallbackObjectWithDataArg, setCallbackString, setCallbackStringArr, setCallbackStringArrWithDataArg, setCallbackStringWithDataArg, setCallbackVoid, setCallbackVoidWithDataArg, setNull
-
-
-
-
Field Detail
-
itemRegistry
public static final RegistryNamespaced<ResourceLocation,Item> itemRegistry
-
itemModifierUUID
protected static final EaglercraftUUID itemModifierUUID
-
itemRand
protected static EaglercraftRandom itemRand
+ The RNG used by the Item subclasses.
-
maxStackSize
protected int maxStackSize
+ Maximum size of the stack.
-
bFull3D
protected boolean bFull3D
-
hasSubtypes
protected boolean hasSubtypes
-
-
Method Detail
-
getIdFromItem
public static int getIdFromItem(Item itemIn)
-
getItemById
public static Item getItemById(int id)
-
loadPluginData
public void loadPluginData(BaseData data)
-
makePluginData
public PluginData makePluginData()
-
getByNameOrId
public static Item getByNameOrId(java.lang.String id)
+ Tries to get an Item by it's name (e.g. minecraft:apple) or a String representation of a numerical ID. If both fail, null is returned.
-
updateItemStackNBT
public boolean updateItemStackNBT(NBTTagCompound var1)
+ Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data
-
setMaxStackSize
public Item setMaxStackSize(int maxStackSize)
-
onItemUse
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, BlockPos var4, EnumFacing var5, float var6, float var7, float var8)
+ Called when a Block is right-clicked with this Item
-
onItemRightClick
public ItemStack onItemRightClick(ItemStack itemstack, World var2, EntityPlayer var3)
+ Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
-
onItemUseFinish
public ItemStack onItemUseFinish(ItemStack itemstack, World var2, EntityPlayer var3)
+ Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using the Item before the action is complete.
-
getItemStackLimit
public int getItemStackLimit()
+ Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
-
getMetadata
public int getMetadata(int var1)
+ Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is placed as a Block (mostly used with ItemBlocks).
-
getHasSubtypes
public boolean getHasSubtypes()
-
setHasSubtypes
protected Item setHasSubtypes(boolean hasSubtypes)
-
getMaxDamage
public int getMaxDamage()
+ Returns the maximum damage an item can take.
-
setMaxDamage
protected Item setMaxDamage(int maxDamageIn)
+ set max damage of an Item
-
isDamageable
public boolean isDamageable()
-
hitEntity
public boolean hitEntity(ItemStack var1, EntityLivingBase var2, EntityLivingBase var3)
+ Current implementations of this method in child classes do not use the entry argument beside ev. They just raise the damage on the stack.
-
onBlockDestroyed
public boolean onBlockDestroyed(ItemStack var1, World var2, Block var3, BlockPos var4, EntityLivingBase var5)
+ Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
-
canHarvestBlock
public boolean canHarvestBlock(Block var1)
+ Check whether this Item can harvest the given Block
-
itemInteractionForEntity
public boolean itemInteractionForEntity(ItemStack var1, EntityPlayer var2, EntityLivingBase var3)
+ Returns true if the item can be used on the given entity, e.g. shears on sheep.
-
setFull3D
public Item setFull3D()
+ Sets bFull3D to True and return the object.
-
isFull3D
public boolean isFull3D()
+ Returns True is the item is renderer in full 3D when hold.
-
shouldRotateAroundWhenRendering
public boolean shouldRotateAroundWhenRendering()
+ Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities hands.
-
setUnlocalizedName
public Item setUnlocalizedName(java.lang.String s)
+ Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."
-
getUnlocalizedNameInefficiently
public java.lang.String getUnlocalizedNameInefficiently(ItemStack stack)
+ Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the unlocalized name itself is returned.
-
getUnlocalizedName
public java.lang.String getUnlocalizedName()
+ Returns the unlocalized name of this item.
-
getUnlocalizedName
public java.lang.String getUnlocalizedName(ItemStack var1)
+ Returns the unlocalized name of this item.
-
getShareTag
public boolean getShareTag()
+ If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.
-
getContainerItem
public Item getContainerItem()
-
hasContainerItem
public boolean hasContainerItem()
+ True if this Item has a container item (a.k.a. crafting result)
-
getColorFromItemStack
public int getColorFromItemStack(ItemStack var1, int var2)
-
onUpdate
public void onUpdate(ItemStack var1, World var2, Entity var3, int var4, boolean var5)
+ Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and update it's contents.
-
onCreated
public void onCreated(ItemStack var1, World var2, EntityPlayer var3)
+ Called when item is crafted/smelted. Used only by maps so far.
-
isMap
public boolean isMap()
+ false for all Items except sub-classes of ItemMapBase
-
getItemUseAction
public EnumAction getItemUseAction(ItemStack var1)
+ returns the action that specifies what animation to play when the items is being used
-
getMaxItemUseDuration
public int getMaxItemUseDuration(ItemStack var1)
+ How long it takes to use or consume an item
-
onPlayerStoppedUsing
public void onPlayerStoppedUsing(ItemStack var1, World var2, EntityPlayer var3, int var4)
+ Called when the player stops using an Item (stops holding the right mouse button).
-
setPotionEffect
protected Item setPotionEffect(java.lang.String potionEffect)
+ Sets the string representing this item's effect on a potion when used as an ingredient.
-
getPotionEffect
public java.lang.String getPotionEffect(ItemStack var1)
-
isPotionIngredient
public boolean isPotionIngredient(ItemStack stack)
-
addInformation
public void addInformation(ItemStack var1, EntityPlayer var2, java.util.List<java.lang.String> var3, boolean var4)
+ allows items to add custom lines of information to the mouseover description
-
getItemStackDisplayName
public java.lang.String getItemStackDisplayName(ItemStack itemstack)
-
hasEffect
public boolean hasEffect(ItemStack itemstack)
-
getRarity
public EnumRarity getRarity(ItemStack itemstack)
+ Return an item rarity from EnumRarity
-
isItemTool
public boolean isItemTool(ItemStack var1)
+ Checks isDamagable and if it cannot be stacked
-
getMovingObjectPositionFromPlayer
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)
-
getItemEnchantability
public int getItemEnchantability()
+ Return the enchantability factor of the item, most of the time is based on material.
-
getSubItems
public void getSubItems(Item item, CreativeTabs var2, java.util.List<ItemStack> list)
+ returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
-
getCreativeTab
public CreativeTabs getCreativeTab()
+ gets the CreativeTab this item is displayed on
-
setCreativeTab
public Item setCreativeTab(CreativeTabs tab)
+ returns this;
-
canItemEditBlocks
public boolean canItemEditBlocks()
+ Returns true if players can use this item to affect the world (e.g. placing blocks, placing ender eyes in portal) when not in creative
-
getIsRepairable
public boolean getIsRepairable(ItemStack var1, ItemStack var2)
+ Return whether this item is repairable in an anvil.
-
getItemAttributeModifiers
public Multimap<java.lang.String,AttributeModifier> getItemAttributeModifiers()
-
registerItems
public static void registerItems()
-
-