jokekid

Untitled

Aug 15th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 79.61 KB | None | 0 0
  1. package net.minecraft.item;
  2.  
  3. import com.google.common.base.Function;
  4. import com.google.common.collect.HashMultimap;
  5. import com.google.common.collect.Maps;
  6. import com.google.common.collect.Multimap;
  7. import java.util.List;
  8. import java.util.Map;
  9. import java.util.Random;
  10. import java.util.UUID;
  11. import net.minecraft.block.Block;
  12. import net.minecraft.block.BlockDirt;
  13. import net.minecraft.block.BlockDoublePlant;
  14. import net.minecraft.block.BlockFlower;
  15. import net.minecraft.block.BlockPlanks;
  16. import net.minecraft.block.BlockPrismarine;
  17. import net.minecraft.block.BlockRedSandstone;
  18. import net.minecraft.block.BlockSand;
  19. import net.minecraft.block.BlockSandStone;
  20. import net.minecraft.block.BlockSilverfish;
  21. import net.minecraft.block.BlockStone;
  22. import net.minecraft.block.BlockStoneBrick;
  23. import net.minecraft.block.BlockWall;
  24. import net.minecraft.creativetab.CreativeTabs;
  25. import net.minecraft.entity.Entity;
  26. import net.minecraft.entity.EntityLivingBase;
  27. import net.minecraft.entity.item.EntityItemFrame;
  28. import net.minecraft.entity.item.EntityMinecart;
  29. import net.minecraft.entity.item.EntityPainting;
  30. import net.minecraft.entity.player.EntityPlayer;
  31. import net.minecraft.init.Blocks;
  32. import net.minecraft.init.Items;
  33. import net.minecraft.nbt.NBTTagCompound;
  34. import net.minecraft.potion.Potion;
  35. import net.minecraft.potion.PotionHelper;
  36. import net.minecraft.util.BlockPos;
  37. import net.minecraft.util.EnumFacing;
  38. import net.minecraft.util.MathHelper;
  39. import net.minecraft.util.MovingObjectPosition;
  40. import net.minecraft.util.RegistryNamespaced;
  41. import net.minecraft.util.ResourceLocation;
  42. import net.minecraft.util.StatCollector;
  43. import net.minecraft.util.Vec3;
  44. import net.minecraft.world.World;
  45. import net.minecraftforge.fml.relauncher.Side;
  46. import net.minecraftforge.fml.relauncher.SideOnly;
  47.  
  48. public class Item
  49. {
  50.     public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();
  51.     private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap();
  52.     protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
  53.     private CreativeTabs tabToDisplayOn;
  54.     /** The RNG used by the Item subclasses. */
  55.     protected static Random itemRand = new Random();
  56.     /** Maximum size of the stack. */
  57.     protected int maxStackSize = 64;
  58.     /** Maximum damage an item can handle. */
  59.     private int maxDamage;
  60.     /** If true, render the object in full 3D, like weapons and tools. */
  61.     protected boolean bFull3D;
  62.     /** Some items (like dyes) have multiple subtypes on same item, this is field define this behavior */
  63.     protected boolean hasSubtypes;
  64.     private Item containerItem;
  65.     /** The string representing this item's effect on a potion when used as an ingredient. */
  66.     private String potionEffect;
  67.     /** The unlocalized name of this item. */
  68.     private String unlocalizedName;
  69.     private static final String __OBFID = "CL_00000041";
  70.  
  71.     public final net.minecraftforge.fml.common.registry.RegistryDelegate<Item> delegate =
  72.             ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class);
  73.  
  74.     public static int getIdFromItem(Item itemIn)
  75.     {
  76.         return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn);
  77.     }
  78.  
  79.     public static Item getItemById(int id)
  80.     {
  81.         return (Item)itemRegistry.getObjectById(id);
  82.     }
  83.  
  84.     public static Item getItemFromBlock(Block blockIn)
  85.     {
  86.         return (Item)BLOCK_TO_ITEM.get(blockIn);
  87.     }
  88.  
  89.     /**
  90.      * Tries to get an Item by it's name (e.g. minecraft:apple) or a String representation of a numerical ID. If both
  91.      * fail, null is returned.
  92.      */
  93.     public static Item getByNameOrId(String id)
  94.     {
  95.         Item item = (Item)itemRegistry.getObject(new ResourceLocation(id));
  96.  
  97.         if (item == null)
  98.         {
  99.             try
  100.             {
  101.                 return getItemById(Integer.parseInt(id));
  102.             }
  103.             catch (NumberFormatException numberformatexception)
  104.             {
  105.                 ;
  106.             }
  107.         }
  108.  
  109.         return item;
  110.     }
  111.  
  112.     /**
  113.      * Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data
  114.      */
  115.     public boolean updateItemStackNBT(NBTTagCompound nbt)
  116.     {
  117.         return false;
  118.     }
  119.  
  120.     public Item setMaxStackSize(int maxStackSize)
  121.     {
  122.         this.maxStackSize = maxStackSize;
  123.         return this;
  124.     }
  125.  
  126.     /**
  127.      * Called when a Block is right-clicked with this Item
  128.      *  
  129.      * @param pos The block being right-clicked
  130.      * @param side The side being right-clicked
  131.      */
  132.     public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
  133.     {
  134.         return false;
  135.     }
  136.  
  137.     public float getStrVsBlock(ItemStack stack, Block block)
  138.     {
  139.         return 1.0F;
  140.     }
  141.  
  142.     /**
  143.      * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
  144.      */
  145.     public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
  146.     {
  147.         return itemStackIn;
  148.     }
  149.  
  150.     /**
  151.      * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
  152.      * the Item before the action is complete.
  153.      */
  154.     public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
  155.     {
  156.         return stack;
  157.     }
  158.  
  159.     /**
  160.      * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
  161.      */
  162.     @Deprecated // Use ItemStack sensitive version below.
  163.     public int getItemStackLimit()
  164.     {
  165.         return this.maxStackSize;
  166.     }
  167.  
  168.     /**
  169.      * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
  170.      * placed as a Block (mostly used with ItemBlocks).
  171.      */
  172.     public int getMetadata(int damage)
  173.     {
  174.         return 0;
  175.     }
  176.  
  177.     public boolean getHasSubtypes()
  178.     {
  179.         return this.hasSubtypes;
  180.     }
  181.  
  182.     public Item setHasSubtypes(boolean hasSubtypes)
  183.     {
  184.         this.hasSubtypes = hasSubtypes;
  185.         return this;
  186.     }
  187.  
  188.     /**
  189.      * Returns the maximum damage an item can take.
  190.      */
  191.     public int getMaxDamage()
  192.     {
  193.         return this.maxDamage;
  194.     }
  195.  
  196.     /**
  197.      * set max damage of an Item
  198.      */
  199.     public Item setMaxDamage(int maxDamageIn)
  200.     {
  201.         this.maxDamage = maxDamageIn;
  202.         return this;
  203.     }
  204.  
  205.     public boolean isDamageable()
  206.     {
  207.         return this.maxDamage > 0 && !this.hasSubtypes;
  208.     }
  209.  
  210.     /**
  211.      * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
  212.      * the damage on the stack.
  213.      *  
  214.      * @param target The Entity being hit
  215.      * @param attacker the attacking entity
  216.      */
  217.     public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
  218.     {
  219.         return false;
  220.     }
  221.  
  222.     /**
  223.      * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
  224.      */
  225.     public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn)
  226.     {
  227.         return false;
  228.     }
  229.  
  230.     /**
  231.      * Check whether this Item can harvest the given Block
  232.      */
  233.     public boolean canHarvestBlock(Block blockIn)
  234.     {
  235.         return false;
  236.     }
  237.  
  238.     /**
  239.      * Returns true if the item can be used on the given entity, e.g. shears on sheep.
  240.      */
  241.     public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
  242.     {
  243.         return false;
  244.     }
  245.  
  246.     /**
  247.      * Sets bFull3D to True and return the object.
  248.      */
  249.     public Item setFull3D()
  250.     {
  251.         this.bFull3D = true;
  252.         return this;
  253.     }
  254.  
  255.     /**
  256.      * Returns True is the item is renderer in full 3D when hold.
  257.      */
  258.     @SideOnly(Side.CLIENT)
  259.     public boolean isFull3D()
  260.     {
  261.         return this.bFull3D;
  262.     }
  263.  
  264.     /**
  265.      * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities
  266.      * hands.
  267.      */
  268.     @SideOnly(Side.CLIENT)
  269.     public boolean shouldRotateAroundWhenRendering()
  270.     {
  271.         return false;
  272.     }
  273.  
  274.     /**
  275.      * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."
  276.      */
  277.     public Item setUnlocalizedName(String unlocalizedName)
  278.     {
  279.         this.unlocalizedName = unlocalizedName;
  280.         return this;
  281.     }
  282.  
  283.     /**
  284.      * Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the
  285.      * unlocalized name itself is returned.
  286.      */
  287.     public String getUnlocalizedNameInefficiently(ItemStack stack)
  288.     {
  289.         String s = this.getUnlocalizedName(stack);
  290.         return s == null ? "" : StatCollector.translateToLocal(s);
  291.     }
  292.  
  293.     /**
  294.      * Returns the unlocalized name of this item.
  295.      */
  296.     public String getUnlocalizedName()
  297.     {
  298.         return "item." + this.unlocalizedName;
  299.     }
  300.  
  301.     /**
  302.      * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
  303.      * different names based on their damage or NBT.
  304.      */
  305.     public String getUnlocalizedName(ItemStack stack)
  306.     {
  307.         return "item." + this.unlocalizedName;
  308.     }
  309.  
  310.     public Item setContainerItem(Item containerItem)
  311.     {
  312.         this.containerItem = containerItem;
  313.         return this;
  314.     }
  315.  
  316.     /**
  317.      * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.
  318.      */
  319.     public boolean getShareTag()
  320.     {
  321.         return true;
  322.     }
  323.  
  324.     public Item getContainerItem()
  325.     {
  326.         return this.containerItem;
  327.     }
  328.  
  329.     /**
  330.      * True if this Item has a container item (a.k.a. crafting result)
  331.      */
  332.     @Deprecated // Use ItemStack sensitive version below.
  333.     public boolean hasContainerItem()
  334.     {
  335.         return this.containerItem != null;
  336.     }
  337.  
  338.     @SideOnly(Side.CLIENT)
  339.     public int getColorFromItemStack(ItemStack stack, int renderPass)
  340.     {
  341.         return 16777215;
  342.     }
  343.  
  344.     /**
  345.      * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
  346.      * update it's contents.
  347.      */
  348.     public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {}
  349.  
  350.     /**
  351.      * Called when item is crafted/smelted. Used only by maps so far.
  352.      */
  353.     public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) {}
  354.  
  355.     /**
  356.      * false for all Items except sub-classes of ItemMapBase
  357.      */
  358.     public boolean isMap()
  359.     {
  360.         return false;
  361.     }
  362.  
  363.     /**
  364.      * returns the action that specifies what animation to play when the items is being used
  365.      */
  366.     public EnumAction getItemUseAction(ItemStack stack)
  367.     {
  368.         return EnumAction.NONE;
  369.     }
  370.  
  371.     /**
  372.      * How long it takes to use or consume an item
  373.      */
  374.     public int getMaxItemUseDuration(ItemStack stack)
  375.     {
  376.         return 0;
  377.     }
  378.  
  379.     /**
  380.      * Called when the player stops using an Item (stops holding the right mouse button).
  381.      *  
  382.      * @param timeLeft The amount of ticks left before the using would have been complete
  383.      */
  384.     public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) {}
  385.  
  386.     /**
  387.      * Sets the string representing this item's effect on a potion when used as an ingredient.
  388.      */
  389.     public Item setPotionEffect(String potionEffect)
  390.     {
  391.         this.potionEffect = potionEffect;
  392.         return this;
  393.     }
  394.  
  395.     public String getPotionEffect(ItemStack stack)
  396.     {
  397.         return this.potionEffect;
  398.     }
  399.  
  400.     public boolean isPotionIngredient(ItemStack stack)
  401.     {
  402.         return this.getPotionEffect(stack) != null;
  403.     }
  404.  
  405.     /**
  406.      * allows items to add custom lines of information to the mouseover description
  407.      *  
  408.      * @param tooltip All lines to display in the Item's tooltip. This is a List of Strings.
  409.      * @param advanced Whether the setting "Advanced tooltips" is enabled
  410.      */
  411.     @SideOnly(Side.CLIENT)
  412.     public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {}
  413.  
  414.     public String getItemStackDisplayName(ItemStack stack)
  415.     {
  416.         return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
  417.     }
  418.  
  419.     @SideOnly(Side.CLIENT)
  420.     public boolean hasEffect(ItemStack stack)
  421.     {
  422.         return stack.isItemEnchanted();
  423.     }
  424.  
  425.     /**
  426.      * Return an item rarity from EnumRarity
  427.      */
  428.     public EnumRarity getRarity(ItemStack stack)
  429.     {
  430.         return stack.isItemEnchanted() ? EnumRarity.RARE : EnumRarity.COMMON;
  431.     }
  432.  
  433.     /**
  434.      * Checks isDamagable and if it cannot be stacked
  435.      */
  436.     public boolean isItemTool(ItemStack stack)
  437.     {
  438.         return this.getItemStackLimit(stack) == 1 && this.isDamageable();
  439.     }
  440.  
  441.     protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids)
  442.     {
  443.         float f = playerIn.prevRotationPitch + (playerIn.rotationPitch - playerIn.prevRotationPitch);
  444.         float f1 = playerIn.prevRotationYaw + (playerIn.rotationYaw - playerIn.prevRotationYaw);
  445.         double d0 = playerIn.prevPosX + (playerIn.posX - playerIn.prevPosX);
  446.         double d1 = playerIn.prevPosY + (playerIn.posY - playerIn.prevPosY) + (double)playerIn.getEyeHeight();
  447.         double d2 = playerIn.prevPosZ + (playerIn.posZ - playerIn.prevPosZ);
  448.         Vec3 vec3 = new Vec3(d0, d1, d2);
  449.         float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
  450.         float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
  451.         float f4 = -MathHelper.cos(-f * 0.017453292F);
  452.         float f5 = MathHelper.sin(-f * 0.017453292F);
  453.         float f6 = f3 * f4;
  454.         float f7 = f2 * f4;
  455.         double d3 = 5.0D;
  456.         if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP)
  457.         {
  458.             d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance();
  459.         }
  460.         Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
  461.         return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
  462.     }
  463.  
  464.     /**
  465.      * Return the enchantability factor of the item, most of the time is based on material.
  466.      */
  467.     public int getItemEnchantability()
  468.     {
  469.         return 0;
  470.     }
  471.  
  472.     /**
  473.      * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
  474.      *  
  475.      * @param subItems The List of sub-items. This is a List of ItemStacks.
  476.      */
  477.     @SideOnly(Side.CLIENT)
  478.     public void getSubItems(Item itemIn, CreativeTabs tab, List subItems)
  479.     {
  480.         subItems.add(new ItemStack(itemIn, 1, 0));
  481.     }
  482.  
  483.     /**
  484.      * returns this;
  485.      */
  486.     public Item setCreativeTab(CreativeTabs tab)
  487.     {
  488.         this.tabToDisplayOn = tab;
  489.         return this;
  490.     }
  491.  
  492.     /**
  493.      * gets the CreativeTab this item is displayed on
  494.      */
  495.     @SideOnly(Side.CLIENT)
  496.     public CreativeTabs getCreativeTab()
  497.     {
  498.         return this.tabToDisplayOn;
  499.     }
  500.  
  501.     /**
  502.      * Returns true if players can use this item to affect the world (e.g. placing blocks, placing ender eyes in portal)
  503.      * when not in creative
  504.      */
  505.     public boolean canItemEditBlocks()
  506.     {
  507.         return false;
  508.     }
  509.  
  510.     /**
  511.      * Return whether this item is repairable in an anvil.
  512.      *  
  513.      * @param toRepair The ItemStack to be repaired
  514.      * @param repair The ItemStack that should repair this Item (leather for leather armor, etc.)
  515.      */
  516.     public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
  517.     {
  518.         return false;
  519.     }
  520.  
  521.     /**
  522.      * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
  523.      */
  524.     @Deprecated // Use ItemStack sensitive version below.
  525.     public Multimap getItemAttributeModifiers()
  526.     {
  527.         return HashMultimap.create();
  528.     }
  529.  
  530.     /* ======================================== FORGE START =====================================*/
  531.     /**
  532.      * ItemStack sensitive version of getItemAttributeModifiers
  533.      */
  534.     public Multimap getAttributeModifiers(ItemStack stack)
  535.     {
  536.         return this.getItemAttributeModifiers();
  537.     }
  538.  
  539.     /**
  540.      * Called when a player drops the item into the world,
  541.      * returning false from this will prevent the item from
  542.      * being removed from the players inventory and spawning
  543.      * in the world
  544.      *
  545.      * @param player The player that dropped the item
  546.      * @param item The item stack, before the item is removed.
  547.      */
  548.     public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
  549.     {
  550.         return true;
  551.     }
  552.  
  553.     /**
  554.      * This is called when the item is used, before the block is activated.
  555.      * @param stack The Item Stack
  556.      * @param player The Player that used the item
  557.      * @param world The Current World
  558.      * @param pos Target position
  559.      * @param side The side of the target hit
  560.      * @return Return true to prevent any further processing.
  561.      */
  562.     public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
  563.     {
  564.         return false;
  565.     }
  566.  
  567.     /**
  568.      * Metadata-sensitive version of getStrVsBlock
  569.      * @param itemstack The Item Stack
  570.      * @param state The block state
  571.      * @return The damage strength
  572.      */
  573.     public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state)
  574.     {
  575.         return getStrVsBlock(itemstack, state.getBlock());
  576.     }
  577.  
  578.  
  579.     protected boolean canRepair = true;
  580.     /**
  581.      * Called by CraftingManager to determine if an item is reparable.
  582.      * @return True if reparable
  583.      */
  584.     public boolean isRepairable()
  585.     {
  586.         return canRepair && isDamageable();
  587.     }
  588.  
  589.     /**
  590.      * Call to disable repair recipes.
  591.      * @return The current Item instance
  592.      */
  593.     public Item setNoRepair()
  594.     {
  595.         canRepair = false;
  596.         return this;
  597.     }
  598.  
  599.     /**
  600.      * Called before a block is broken.  Return true to prevent default block harvesting.
  601.      *
  602.      * Note: In SMP, this is called on both client and server sides!
  603.      *
  604.      * @param itemstack The current ItemStack
  605.      * @param pos Block's position in world
  606.      * @param player The Player that is wielding the item
  607.      * @return True to prevent harvesting, false to continue as normal
  608.      */
  609.     public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
  610.     {
  611.         return false;
  612.     }
  613.  
  614.     /**
  615.      * Called each tick while using an item.
  616.      * @param stack The Item being used
  617.      * @param player The Player using the item
  618.      * @param count The amount of time in tick the item has been used for continuously
  619.      */
  620.     public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
  621.     {
  622.     }
  623.  
  624.     /**
  625.      * Called when the player Left Clicks (attacks) an entity.
  626.      * Processed before damage is done, if return value is true further processing is canceled
  627.      * and the entity is not attacked.
  628.      *
  629.      * @param stack The Item being used
  630.      * @param player The player that is attacking
  631.      * @param entity The entity being attacked
  632.      * @return True to cancel the rest of the interaction.
  633.      */
  634.     public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
  635.     {
  636.         return false;
  637.     }
  638.  
  639.     /**
  640.      * Player, Render pass, and item usage sensitive version of getIconIndex.
  641.      *
  642.      * @param stack The item stack to get the icon for.
  643.      * @param player The player holding the item
  644.      * @param useRemaining The ticks remaining for the active item.
  645.      * @return Null to use default model, or a custom ModelResourceLocation for the stage of use.
  646.      */
  647.     @SideOnly(Side.CLIENT)
  648.     public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
  649.     {
  650.         return null;
  651.     }
  652.  
  653.     /**
  654.      * ItemStack sensitive version of getContainerItem.
  655.      * Returns a full ItemStack instance of the result.
  656.      *
  657.      * @param itemStack The current ItemStack
  658.      * @return The resulting ItemStack
  659.      */
  660.     public ItemStack getContainerItem(ItemStack itemStack)
  661.     {
  662.         if (!hasContainerItem(itemStack))
  663.         {
  664.             return null;
  665.         }
  666.         return new ItemStack(getContainerItem());
  667.     }
  668.  
  669.     /**
  670.      * ItemStack sensitive version of hasContainerItem
  671.      * @param stack The current item stack
  672.      * @return True if this item has a 'container'
  673.      */
  674.     public boolean hasContainerItem(ItemStack stack)
  675.     {
  676.         /**
  677.          * True if this Item has a container item (a.k.a. crafting result)
  678.          */
  679.         return hasContainerItem();
  680.     }
  681.  
  682.     /**
  683.      * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem.
  684.      * This is in ticks, standard result is 6000, or 5 mins.
  685.      *
  686.      * @param itemStack The current ItemStack
  687.      * @param world The world the entity is in
  688.      * @return The normal lifespan in ticks.
  689.      */
  690.     public int getEntityLifespan(ItemStack itemStack, World world)
  691.     {
  692.         return 6000;
  693.     }
  694.  
  695.     /**
  696.      * Determines if this Item has a special entity for when they are in the world.
  697.      * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity
  698.      * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world.
  699.      *
  700.      * @param stack The current item stack
  701.      * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called
  702.      */
  703.     public boolean hasCustomEntity(ItemStack stack)
  704.     {
  705.         return false;
  706.     }
  707.  
  708.     /**
  709.      * This function should return a new entity to replace the dropped item.
  710.      * Returning null here will not kill the EntityItem and will leave it to function normally.
  711.      * Called when the item it placed in a world.
  712.      *
  713.      * @param world The world object
  714.      * @param location The EntityItem object, useful for getting the position of the entity
  715.      * @param itemstack The current item stack
  716.      * @return A new Entity object to spawn or null
  717.      */
  718.     public Entity createEntity(World world, Entity location, ItemStack itemstack)
  719.     {
  720.         return null;
  721.     }
  722.  
  723.     /**
  724.      * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner
  725.      * control over the update of the item without having to write a subclass.
  726.      *
  727.      * @param entityItem The entity Item
  728.      * @return Return true to skip any further update code.
  729.      */
  730.     public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem)
  731.     {
  732.         return false;
  733.     }
  734.  
  735.     /**
  736.      * Gets a list of tabs that items belonging to this class can display on,
  737.      * combined properly with getSubItems allows for a single item to span
  738.      * many sub-items across many tabs.
  739.      *
  740.      * @return A list of all tabs that this item could possibly be one.
  741.      */
  742.     public CreativeTabs[] getCreativeTabs()
  743.     {
  744.         return new CreativeTabs[]{ getCreativeTab() };
  745.     }
  746.  
  747.     /**
  748.      * Determines the base experience for a player when they remove this item from a furnace slot.
  749.      * This number must be between 0 and 1 for it to be valid.
  750.      * This number will be multiplied by the stack size to get the total experience.
  751.      *
  752.      * @param item The item stack the player is picking up.
  753.      * @return The amount to award for each item.
  754.      */
  755.     public float getSmeltingExperience(ItemStack item)
  756.     {
  757.         return -1; //-1 will default to the old lookups.
  758.     }
  759.  
  760.     /**
  761.      * Return the correct icon for rendering based on the supplied ItemStack and render pass.
  762.      *
  763.      * Defers to {@link #getIconFromDamageForRenderPass(int, int)}
  764.      * @param stack to render for
  765.      * @param pass the multi-render pass
  766.      * @return the icon
  767.      * /
  768.     public IIcon getIcon(ItemStack stack, int pass)
  769.     {
  770.         return func_77618_c(stack.getMetadata(), pass);
  771.     }
  772.     */
  773.  
  774.     /**
  775.      * Generates the base Random item for a specific instance of the chest gen,
  776.      * Enchanted books use this to pick a random enchantment.
  777.      *
  778.      * @param chest The chest category to generate for
  779.      * @param rnd World RNG
  780.      * @param original Original result registered with the chest gen hooks.
  781.      * @return New values to use as the random item, typically this will be original
  782.      */
  783.     public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original)
  784.     {
  785.         if (this instanceof ItemEnchantedBook)
  786.         {
  787.             return ((ItemEnchantedBook)this).getRandom(rnd,
  788.                     original.theMinimumChanceToGenerateItem,
  789.                     original.theMaximumChanceToGenerateItem, original.itemWeight);
  790.         }
  791.         return original;
  792.     }
  793.  
  794.     /**
  795.      *
  796.      * Should this item, when held, allow sneak-clicks to pass through to the underlying block?
  797.      *
  798.      * @param world The world
  799.      * @param pos Block position in world
  800.      * @param player The Player that is wielding the item
  801.      * @return
  802.      */
  803.     public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player)
  804.     {
  805.         return false;
  806.     }
  807.  
  808.     /**
  809.      * Called to tick armor in the armor slot. Override to do something
  810.      */
  811.     public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){}
  812.  
  813.     /**
  814.      * Determines if the specific ItemStack can be placed in the specified armor slot.
  815.      *
  816.      * @param stack The ItemStack
  817.      * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots
  818.      * @param entity The entity trying to equip the armor
  819.      * @return True if the given ItemStack can be inserted in the slot
  820.      */
  821.     public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
  822.     {
  823.         if (this instanceof ItemArmor)
  824.         {
  825.             return ((ItemArmor)this).armorType == armorType;
  826.         }
  827.  
  828.         if (armorType == 0)
  829.         {
  830.             return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull;
  831.         }
  832.  
  833.         return false;
  834.     }
  835.  
  836.     /**
  837.      * Allow or forbid the specific book/item combination as an anvil enchant
  838.      *
  839.      * @param stack The item
  840.      * @param book The book
  841.      * @return if the enchantment is allowed
  842.      */
  843.     public boolean isBookEnchantable(ItemStack stack, ItemStack book)
  844.     {
  845.         return true;
  846.     }
  847.  
  848.     /**
  849.      * Called by RenderBiped and RenderPlayer to determine the armor texture that
  850.      * should be use for the currently equipped item.
  851.      * This will only be called on instances of ItemArmor.
  852.      *
  853.      * Returning null from this function will use the default value.
  854.      *
  855.      * @param stack ItemStack for the equipped armor
  856.      * @param entity The entity wearing the armor
  857.      * @param slot The slot the armor is in
  858.      * @param type The subtype, can be null or "overlay"
  859.      * @return Path of texture to bind, or null to use default
  860.      */
  861.     public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
  862.     {
  863.         return null;
  864.     }
  865.  
  866.     /**
  867.      * Returns the font renderer used to render tooltips and overlays for this item.
  868.      * Returning null will use the standard font renderer.
  869.      *
  870.      * @param stack The current item stack
  871.      * @return A instance of FontRenderer or null to use default
  872.      */
  873.     @SideOnly(Side.CLIENT)
  874.     public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack)
  875.     {
  876.         return null;
  877.     }
  878.  
  879.     /**
  880.      * Override this method to have an item handle its own armor rendering.
  881.      *
  882.      * @param  entityLiving  The entity wearing the armor
  883.      * @param  itemStack  The itemStack to render the model of
  884.      * @param  armorSlot  0=head, 1=torso, 2=legs, 3=feet
  885.      *
  886.      * @return  A ModelBiped to render instead of the default
  887.      */
  888.     @SideOnly(Side.CLIENT)
  889.     public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
  890.     {
  891.         return null;
  892.     }
  893.  
  894.     /**
  895.      * Called when a entity tries to play the 'swing' animation.
  896.      *
  897.      * @param entityLiving The entity swinging the item.
  898.      * @param stack The Item stack
  899.      * @return True to cancel any further processing by EntityLiving
  900.      */
  901.     public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack)
  902.     {
  903.         return false;
  904.     }
  905.  
  906.     /**
  907.      * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet.
  908.      * This is where pumpkins would render there overlay.
  909.      *
  910.      * @param stack The ItemStack that is equipped
  911.      * @param player Reference to the current client entity
  912.      * @param resolution Resolution information about the current viewport and configured GUI Scale
  913.      * @param partialTicks Partial ticks for the renderer, useful for interpolation
  914.      */
  915.     @SideOnly(Side.CLIENT)
  916.     public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){}
  917.  
  918.     /**
  919.      * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT.
  920.      *
  921.      * @param stack The itemstack that is damaged
  922.      * @return the damage value
  923.      */
  924.     public int getDamage(ItemStack stack)
  925.     {
  926.         return stack.itemDamage;
  927.     }
  928.  
  929.     /**
  930.      * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage.
  931.      * @param stack
  932.      * @return
  933.      */
  934.     public int getMetadata(ItemStack stack)
  935.     {
  936.         return stack.itemDamage;
  937.     }
  938.  
  939.     /**
  940.      * Determines if the durability bar should be rendered for this item.
  941.      * Defaults to vanilla stack.isDamaged behavior.
  942.      * But modders can use this for any data they wish.
  943.      *
  944.      * @param stack The current Item Stack
  945.      * @return True if it should render the 'durability' bar.
  946.      */
  947.     public boolean showDurabilityBar(ItemStack stack)
  948.     {
  949.         return stack.isItemDamaged();
  950.     }
  951.  
  952.     /**
  953.      * Queries the percentage of the 'Durability' bar that should be drawn.
  954.      *
  955.      * @param stack The current ItemStack
  956.      * @return 1.0 for 100% 0 for 0%
  957.      */
  958.     public double getDurabilityForDisplay(ItemStack stack)
  959.     {
  960.         return (double)stack.getItemDamage() / (double)stack.getMaxDamage();
  961.     }
  962.  
  963.     /**
  964.      * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item,
  965.      * but can be overridden here for other sources such as NBT.
  966.      *
  967.      * @param stack The itemstack that is damaged
  968.      * @return the damage value
  969.      */
  970.     public int getMaxDamage(ItemStack stack)
  971.     {
  972.         /**
  973.          * Returns the maximum damage an item can take.
  974.          */
  975.         return getMaxDamage();
  976.     }
  977.  
  978.     /**
  979.      * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true.
  980.      * @param stack the stack
  981.      * @return if the stack is damaged
  982.      */
  983.     public boolean isDamaged(ItemStack stack)
  984.     {
  985.         return stack.itemDamage > 0;
  986.     }
  987.  
  988.     /**
  989.      * Set the damage for this itemstack. Note, this method is responsible for zero checking.
  990.      * @param stack the stack
  991.      * @param damage the new damage value
  992.      */
  993.     public void setDamage(ItemStack stack, int damage)
  994.     {
  995.         stack.itemDamage = damage;
  996.  
  997.         if (stack.itemDamage < 0)
  998.         {
  999.             stack.itemDamage = 0;
  1000.         }
  1001.     }
  1002.  
  1003.     /**
  1004.      * ItemStack sensitive version of {@link #canHarvestBlock(Block)}
  1005.      * @param par1Block The block trying to harvest
  1006.      * @param itemStack The itemstack used to harvest the block
  1007.      * @return true if can harvest the block
  1008.      */
  1009.     public boolean canHarvestBlock(Block par1Block, ItemStack itemStack)
  1010.     {
  1011.         /**
  1012.          * Check whether this Item can harvest the given Block
  1013.          */
  1014.         return canHarvestBlock(par1Block);
  1015.     }
  1016.  
  1017.     /**
  1018.      * Gets the maximum number of items that this stack should be able to hold.
  1019.      * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit()
  1020.      *
  1021.      * @param stack The ItemStack
  1022.      * @return THe maximum number this item can be stacked to
  1023.      */
  1024.     public int getItemStackLimit(ItemStack stack)
  1025.     {
  1026.         return this.getItemStackLimit();
  1027.     }
  1028.  
  1029.     private java.util.Map<String, Integer> toolClasses = new java.util.HashMap<String, Integer>();
  1030.     /**
  1031.      * Sets or removes the harvest level for the specified tool class.
  1032.      *
  1033.      * @param toolClass Class
  1034.      * @param level Harvest level:
  1035.      *     Wood:    0
  1036.      *     Stone:   1
  1037.      *     Iron:    2
  1038.      *     Diamond: 3
  1039.      *     Gold:    0
  1040.      */
  1041.     public void setHarvestLevel(String toolClass, int level)
  1042.     {
  1043.         if (level < 0)
  1044.             toolClasses.remove(toolClass);
  1045.         else
  1046.             toolClasses.put(toolClass, level);
  1047.     }
  1048.  
  1049.     public java.util.Set<String> getToolClasses(ItemStack stack)
  1050.     {
  1051.         return toolClasses.keySet();
  1052.     }
  1053.  
  1054.     /**
  1055.      * Queries the harvest level of this item stack for the specifred tool class,
  1056.      * Returns -1 if this tool is not of the specified type
  1057.      *
  1058.      * @param stack This item stack instance
  1059.      * @param toolClass Tool Class
  1060.      * @return Harvest level, or -1 if not the specified tool type.
  1061.      */
  1062.     public int getHarvestLevel(ItemStack stack, String toolClass)
  1063.     {
  1064.         Integer ret = toolClasses.get(toolClass);
  1065.         return ret == null ? -1 : ret;
  1066.     }
  1067.  
  1068.     /**
  1069.      * ItemStack sensitive version of getItemEnchantability
  1070.      *
  1071.      * @param stack The ItemStack
  1072.      * @return the item echantability value
  1073.      */
  1074.     public int getItemEnchantability(ItemStack stack)
  1075.     {
  1076.         /**
  1077.          * Return the enchantability factor of the item, most of the time is based on material.
  1078.          */
  1079.         return getItemEnchantability();
  1080.     }
  1081.  
  1082.     /**
  1083.      * Whether this Item can be used as a payment to activate the vanilla beacon.
  1084.      * @param stack the ItemStack
  1085.      * @return true if this Item can be used
  1086.      */
  1087.     public boolean isBeaconPayment(ItemStack stack)
  1088.     {
  1089.         return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot;
  1090.     }
  1091.     /* ======================================== FORGE END   =====================================*/
  1092.  
  1093.  
  1094.     public static void registerItems()
  1095.     {
  1096.         registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function()
  1097.         {
  1098.             private static final String __OBFID = "CL_00002178";
  1099.             public String apply(ItemStack stack)
  1100.             {
  1101.                 return BlockStone.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1102.             }
  1103.             public Object apply(Object p_apply_1_)
  1104.             {
  1105.                 return this.apply((ItemStack)p_apply_1_);
  1106.             }
  1107.         })).setUnlocalizedName("stone"));
  1108.         registerItemBlock(Blocks.grass, new ItemColored(Blocks.grass, false));
  1109.         registerItemBlock(Blocks.dirt, (new ItemMultiTexture(Blocks.dirt, Blocks.dirt, new Function()
  1110.         {
  1111.             private static final String __OBFID = "CL_00002169";
  1112.             public String apply(ItemStack stack)
  1113.             {
  1114.                 return BlockDirt.DirtType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1115.             }
  1116.             public Object apply(Object p_apply_1_)
  1117.             {
  1118.                 return this.apply((ItemStack)p_apply_1_);
  1119.             }
  1120.         })).setUnlocalizedName("dirt"));
  1121.         registerItemBlock(Blocks.cobblestone);
  1122.         registerItemBlock(Blocks.planks, (new ItemMultiTexture(Blocks.planks, Blocks.planks, new Function()
  1123.         {
  1124.             private static final String __OBFID = "CL_00002168";
  1125.             public String apply(ItemStack stack)
  1126.             {
  1127.                 return BlockPlanks.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1128.             }
  1129.             public Object apply(Object p_apply_1_)
  1130.             {
  1131.                 return this.apply((ItemStack)p_apply_1_);
  1132.             }
  1133.         })).setUnlocalizedName("wood"));
  1134.         registerItemBlock(Blocks.sapling, (new ItemMultiTexture(Blocks.sapling, Blocks.sapling, new Function()
  1135.         {
  1136.             private static final String __OBFID = "CL_00002167";
  1137.             public String apply(ItemStack stack)
  1138.             {
  1139.                 return BlockPlanks.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1140.             }
  1141.             public Object apply(Object p_apply_1_)
  1142.             {
  1143.                 return this.apply((ItemStack)p_apply_1_);
  1144.             }
  1145.         })).setUnlocalizedName("sapling"));
  1146.         registerItemBlock(Blocks.bedrock);
  1147.         registerItemBlock(Blocks.sand, (new ItemMultiTexture(Blocks.sand, Blocks.sand, new Function()
  1148.         {
  1149.             private static final String __OBFID = "CL_00002166";
  1150.             public String apply(ItemStack stack)
  1151.             {
  1152.                 return BlockSand.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1153.             }
  1154.             public Object apply(Object p_apply_1_)
  1155.             {
  1156.                 return this.apply((ItemStack)p_apply_1_);
  1157.             }
  1158.         })).setUnlocalizedName("sand"));
  1159.         registerItemBlock(Blocks.gravel);
  1160.         registerItemBlock(Blocks.gold_ore);
  1161.         registerItemBlock(Blocks.iron_ore);
  1162.         registerItemBlock(Blocks.coal_ore);
  1163.         registerItemBlock(Blocks.log, (new ItemMultiTexture(Blocks.log, Blocks.log, new Function()
  1164.         {
  1165.             private static final String __OBFID = "CL_00002165";
  1166.             public String apply(ItemStack stack)
  1167.             {
  1168.                 return BlockPlanks.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1169.             }
  1170.             public Object apply(Object p_apply_1_)
  1171.             {
  1172.                 return this.apply((ItemStack)p_apply_1_);
  1173.             }
  1174.         })).setUnlocalizedName("log"));
  1175.         registerItemBlock(Blocks.log2, (new ItemMultiTexture(Blocks.log2, Blocks.log2, new Function()
  1176.         {
  1177.             private static final String __OBFID = "CL_00002164";
  1178.             public String apply(ItemStack stack)
  1179.             {
  1180.                 return BlockPlanks.EnumType.byMetadata(stack.getMetadata() + 4).getUnlocalizedName();
  1181.             }
  1182.             public Object apply(Object p_apply_1_)
  1183.             {
  1184.                 return this.apply((ItemStack)p_apply_1_);
  1185.             }
  1186.         })).setUnlocalizedName("log"));
  1187.         registerItemBlock(Blocks.leaves, (new ItemLeaves(Blocks.leaves)).setUnlocalizedName("leaves"));
  1188.         registerItemBlock(Blocks.leaves2, (new ItemLeaves(Blocks.leaves2)).setUnlocalizedName("leaves"));
  1189.         registerItemBlock(Blocks.sponge, (new ItemMultiTexture(Blocks.sponge, Blocks.sponge, new Function()
  1190.         {
  1191.             private static final String __OBFID = "CL_00002163";
  1192.             public String apply(ItemStack stack)
  1193.             {
  1194.                 return (stack.getMetadata() & 1) == 1 ? "wet" : "dry";
  1195.             }
  1196.             public Object apply(Object p_apply_1_)
  1197.             {
  1198.                 return this.apply((ItemStack)p_apply_1_);
  1199.             }
  1200.         })).setUnlocalizedName("sponge"));
  1201.         registerItemBlock(Blocks.glass);
  1202.         registerItemBlock(Blocks.lapis_ore);
  1203.         registerItemBlock(Blocks.lapis_block);
  1204.         registerItemBlock(Blocks.dispenser);
  1205.         registerItemBlock(Blocks.sandstone, (new ItemMultiTexture(Blocks.sandstone, Blocks.sandstone, new Function()
  1206.         {
  1207.             private static final String __OBFID = "CL_00002162";
  1208.             public String apply(ItemStack stack)
  1209.             {
  1210.                 return BlockSandStone.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1211.             }
  1212.             public Object apply(Object p_apply_1_)
  1213.             {
  1214.                 return this.apply((ItemStack)p_apply_1_);
  1215.             }
  1216.         })).setUnlocalizedName("sandStone"));
  1217.         registerItemBlock(Blocks.noteblock);
  1218.         registerItemBlock(Blocks.golden_rail);
  1219.         registerItemBlock(Blocks.detector_rail);
  1220.         registerItemBlock(Blocks.sticky_piston, new ItemPiston(Blocks.sticky_piston));
  1221.         registerItemBlock(Blocks.web);
  1222.         registerItemBlock(Blocks.tallgrass, (new ItemColored(Blocks.tallgrass, true)).setSubtypeNames(new String[] {"shrub", "grass", "fern"}));
  1223.         registerItemBlock(Blocks.deadbush);
  1224.         registerItemBlock(Blocks.piston, new ItemPiston(Blocks.piston));
  1225.         registerItemBlock(Blocks.wool, (new ItemCloth(Blocks.wool)).setUnlocalizedName("cloth"));
  1226.         registerItemBlock(Blocks.yellow_flower, (new ItemMultiTexture(Blocks.yellow_flower, Blocks.yellow_flower, new Function()
  1227.         {
  1228.             private static final String __OBFID = "CL_00002177";
  1229.             public String apply(ItemStack stack)
  1230.             {
  1231.                 return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.YELLOW, stack.getMetadata()).getUnlocalizedName();
  1232.             }
  1233.             public Object apply(Object p_apply_1_)
  1234.             {
  1235.                 return this.apply((ItemStack)p_apply_1_);
  1236.             }
  1237.         })).setUnlocalizedName("flower"));
  1238.         registerItemBlock(Blocks.red_flower, (new ItemMultiTexture(Blocks.red_flower, Blocks.red_flower, new Function()
  1239.         {
  1240.             private static final String __OBFID = "CL_00002176";
  1241.             public String apply(ItemStack stack)
  1242.             {
  1243.                 return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.RED, stack.getMetadata()).getUnlocalizedName();
  1244.             }
  1245.             public Object apply(Object p_apply_1_)
  1246.             {
  1247.                 return this.apply((ItemStack)p_apply_1_);
  1248.             }
  1249.         })).setUnlocalizedName("rose"));
  1250.         registerItemBlock(Blocks.brown_mushroom);
  1251.         registerItemBlock(Blocks.red_mushroom);
  1252.         registerItemBlock(Blocks.gold_block);
  1253.         registerItemBlock(Blocks.iron_block);
  1254.         registerItemBlock(Blocks.stone_slab, (new ItemSlab(Blocks.stone_slab, Blocks.stone_slab, Blocks.double_stone_slab)).setUnlocalizedName("stoneSlab"));
  1255.         registerItemBlock(Blocks.brick_block);
  1256.         registerItemBlock(Blocks.tnt);
  1257.         registerItemBlock(Blocks.bookshelf);
  1258.         registerItemBlock(Blocks.mossy_cobblestone);
  1259.         registerItemBlock(Blocks.obsidian);
  1260.         registerItemBlock(Blocks.torch);
  1261.         registerItemBlock(Blocks.mob_spawner);
  1262.         registerItemBlock(Blocks.oak_stairs);
  1263.         registerItemBlock(Blocks.chest);
  1264.         registerItemBlock(Blocks.diamond_ore);
  1265.         registerItemBlock(Blocks.diamond_block);
  1266.         registerItemBlock(Blocks.crafting_table);
  1267.         registerItemBlock(Blocks.farmland);
  1268.         registerItemBlock(Blocks.furnace);
  1269.         registerItemBlock(Blocks.lit_furnace);
  1270.         registerItemBlock(Blocks.ladder);
  1271.         registerItemBlock(Blocks.rail);
  1272.         registerItemBlock(Blocks.stone_stairs);
  1273.         registerItemBlock(Blocks.lever);
  1274.         registerItemBlock(Blocks.stone_pressure_plate);
  1275.         registerItemBlock(Blocks.wooden_pressure_plate);
  1276.         registerItemBlock(Blocks.redstone_ore);
  1277.         registerItemBlock(Blocks.redstone_torch);
  1278.         registerItemBlock(Blocks.stone_button);
  1279.         registerItemBlock(Blocks.snow_layer, new ItemSnow(Blocks.snow_layer));
  1280.         registerItemBlock(Blocks.ice);
  1281.         registerItemBlock(Blocks.snow);
  1282.         registerItemBlock(Blocks.cactus);
  1283.         registerItemBlock(Blocks.clay);
  1284.         registerItemBlock(Blocks.jukebox);
  1285.         registerItemBlock(Blocks.oak_fence);
  1286.         registerItemBlock(Blocks.spruce_fence);
  1287.         registerItemBlock(Blocks.birch_fence);
  1288.         registerItemBlock(Blocks.jungle_fence);
  1289.         registerItemBlock(Blocks.dark_oak_fence);
  1290.         registerItemBlock(Blocks.acacia_fence);
  1291.         registerItemBlock(Blocks.pumpkin);
  1292.         registerItemBlock(Blocks.netherrack);
  1293.         registerItemBlock(Blocks.soul_sand);
  1294.         registerItemBlock(Blocks.glowstone);
  1295.         registerItemBlock(Blocks.lit_pumpkin);
  1296.         registerItemBlock(Blocks.trapdoor);
  1297.         registerItemBlock(Blocks.monster_egg, (new ItemMultiTexture(Blocks.monster_egg, Blocks.monster_egg, new Function()
  1298.         {
  1299.             private static final String __OBFID = "CL_00002175";
  1300.             public String apply(ItemStack stack)
  1301.             {
  1302.                 return BlockSilverfish.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1303.             }
  1304.             public Object apply(Object p_apply_1_)
  1305.             {
  1306.                 return this.apply((ItemStack)p_apply_1_);
  1307.             }
  1308.         })).setUnlocalizedName("monsterStoneEgg"));
  1309.         registerItemBlock(Blocks.stonebrick, (new ItemMultiTexture(Blocks.stonebrick, Blocks.stonebrick, new Function()
  1310.         {
  1311.             private static final String __OBFID = "CL_00002174";
  1312.             public String apply(ItemStack stack)
  1313.             {
  1314.                 return BlockStoneBrick.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1315.             }
  1316.             public Object apply(Object p_apply_1_)
  1317.             {
  1318.                 return this.apply((ItemStack)p_apply_1_);
  1319.             }
  1320.         })).setUnlocalizedName("stonebricksmooth"));
  1321.         registerItemBlock(Blocks.brown_mushroom_block);
  1322.         registerItemBlock(Blocks.red_mushroom_block);
  1323.         registerItemBlock(Blocks.iron_bars);
  1324.         registerItemBlock(Blocks.glass_pane);
  1325.         registerItemBlock(Blocks.melon_block);
  1326.         registerItemBlock(Blocks.vine, new ItemColored(Blocks.vine, false));
  1327.         registerItemBlock(Blocks.oak_fence_gate);
  1328.         registerItemBlock(Blocks.spruce_fence_gate);
  1329.         registerItemBlock(Blocks.birch_fence_gate);
  1330.         registerItemBlock(Blocks.jungle_fence_gate);
  1331.         registerItemBlock(Blocks.dark_oak_fence_gate);
  1332.         registerItemBlock(Blocks.acacia_fence_gate);
  1333.         registerItemBlock(Blocks.brick_stairs);
  1334.         registerItemBlock(Blocks.stone_brick_stairs);
  1335.         registerItemBlock(Blocks.mycelium);
  1336.         registerItemBlock(Blocks.waterlily, new ItemLilyPad(Blocks.waterlily));
  1337.         registerItemBlock(Blocks.nether_brick);
  1338.         registerItemBlock(Blocks.nether_brick_fence);
  1339.         registerItemBlock(Blocks.nether_brick_stairs);
  1340.         registerItemBlock(Blocks.enchanting_table);
  1341.         registerItemBlock(Blocks.end_portal_frame);
  1342.         registerItemBlock(Blocks.end_stone);
  1343.         registerItemBlock(Blocks.dragon_egg);
  1344.         registerItemBlock(Blocks.redstone_lamp);
  1345.         registerItemBlock(Blocks.wooden_slab, (new ItemSlab(Blocks.wooden_slab, Blocks.wooden_slab, Blocks.double_wooden_slab)).setUnlocalizedName("woodSlab"));
  1346.         registerItemBlock(Blocks.sandstone_stairs);
  1347.         registerItemBlock(Blocks.emerald_ore);
  1348.         registerItemBlock(Blocks.ender_chest);
  1349.         registerItemBlock(Blocks.tripwire_hook);
  1350.         registerItemBlock(Blocks.emerald_block);
  1351.         registerItemBlock(Blocks.spruce_stairs);
  1352.         registerItemBlock(Blocks.birch_stairs);
  1353.         registerItemBlock(Blocks.jungle_stairs);
  1354.         registerItemBlock(Blocks.command_block);
  1355.         registerItemBlock(Blocks.beacon);
  1356.         registerItemBlock(Blocks.cobblestone_wall, (new ItemMultiTexture(Blocks.cobblestone_wall, Blocks.cobblestone_wall, new Function()
  1357.         {
  1358.             private static final String __OBFID = "CL_00002173";
  1359.             public String apply(ItemStack stack)
  1360.             {
  1361.                 return BlockWall.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1362.             }
  1363.             public Object apply(Object p_apply_1_)
  1364.             {
  1365.                 return this.apply((ItemStack)p_apply_1_);
  1366.             }
  1367.         })).setUnlocalizedName("cobbleWall"));
  1368.         registerItemBlock(Blocks.wooden_button);
  1369.         registerItemBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setUnlocalizedName("anvil"));
  1370.         registerItemBlock(Blocks.trapped_chest);
  1371.         registerItemBlock(Blocks.light_weighted_pressure_plate);
  1372.         registerItemBlock(Blocks.heavy_weighted_pressure_plate);
  1373.         registerItemBlock(Blocks.daylight_detector);
  1374.         registerItemBlock(Blocks.redstone_block);
  1375.         registerItemBlock(Blocks.quartz_ore);
  1376.         registerItemBlock(Blocks.hopper);
  1377.         registerItemBlock(Blocks.quartz_block, (new ItemMultiTexture(Blocks.quartz_block, Blocks.quartz_block, new String[] {"default", "chiseled", "lines"})).setUnlocalizedName("quartzBlock"));
  1378.         registerItemBlock(Blocks.quartz_stairs);
  1379.         registerItemBlock(Blocks.activator_rail);
  1380.         registerItemBlock(Blocks.dropper);
  1381.         registerItemBlock(Blocks.stained_hardened_clay, (new ItemCloth(Blocks.stained_hardened_clay)).setUnlocalizedName("clayHardenedStained"));
  1382.         registerItemBlock(Blocks.barrier);
  1383.         registerItemBlock(Blocks.iron_trapdoor);
  1384.         registerItemBlock(Blocks.hay_block);
  1385.         registerItemBlock(Blocks.carpet, (new ItemCloth(Blocks.carpet)).setUnlocalizedName("woolCarpet"));
  1386.         registerItemBlock(Blocks.hardened_clay);
  1387.         registerItemBlock(Blocks.coal_block);
  1388.         registerItemBlock(Blocks.packed_ice);
  1389.         registerItemBlock(Blocks.acacia_stairs);
  1390.         registerItemBlock(Blocks.dark_oak_stairs);
  1391.         registerItemBlock(Blocks.slime_block);
  1392.         registerItemBlock(Blocks.double_plant, (new ItemDoublePlant(Blocks.double_plant, Blocks.double_plant, new Function()
  1393.         {
  1394.             private static final String __OBFID = "CL_00002172";
  1395.             public String apply(ItemStack stack)
  1396.             {
  1397.                 return BlockDoublePlant.EnumPlantType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1398.             }
  1399.             public Object apply(Object p_apply_1_)
  1400.             {
  1401.                 return this.apply((ItemStack)p_apply_1_);
  1402.             }
  1403.         })).setUnlocalizedName("doublePlant"));
  1404.         registerItemBlock(Blocks.stained_glass, (new ItemCloth(Blocks.stained_glass)).setUnlocalizedName("stainedGlass"));
  1405.         registerItemBlock(Blocks.stained_glass_pane, (new ItemCloth(Blocks.stained_glass_pane)).setUnlocalizedName("stainedGlassPane"));
  1406.         registerItemBlock(Blocks.prismarine, (new ItemMultiTexture(Blocks.prismarine, Blocks.prismarine, new Function()
  1407.         {
  1408.             private static final String __OBFID = "CL_00002171";
  1409.             public String apply(ItemStack stack)
  1410.             {
  1411.                 return BlockPrismarine.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1412.             }
  1413.             public Object apply(Object p_apply_1_)
  1414.             {
  1415.                 return this.apply((ItemStack)p_apply_1_);
  1416.             }
  1417.         })).setUnlocalizedName("prismarine"));
  1418.         registerItemBlock(Blocks.sea_lantern);
  1419.         registerItemBlock(Blocks.red_sandstone, (new ItemMultiTexture(Blocks.red_sandstone, Blocks.red_sandstone, new Function()
  1420.         {
  1421.             private static final String __OBFID = "CL_00002170";
  1422.             public String apply(ItemStack stack)
  1423.             {
  1424.                 return BlockRedSandstone.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
  1425.             }
  1426.             public Object apply(Object p_apply_1_)
  1427.             {
  1428.                 return this.apply((ItemStack)p_apply_1_);
  1429.             }
  1430.         })).setUnlocalizedName("redSandStone"));
  1431.         registerItemBlock(Blocks.red_sandstone_stairs);
  1432.         registerItemBlock(Blocks.stone_slab2, (new ItemSlab(Blocks.stone_slab2, Blocks.stone_slab2, Blocks.double_stone_slab2)).setUnlocalizedName("stoneSlab2"));
  1433.         registerItem(256, "iron_shovel", (new ItemSpade(Item.ToolMaterial.IRON)).setUnlocalizedName("shovelIron"));
  1434.         registerItem(257, "iron_pickaxe", (new ItemPickaxe(Item.ToolMaterial.IRON)).setUnlocalizedName("pickaxeIron"));
  1435.         registerItem(258, "iron_axe", (new ItemAxe(Item.ToolMaterial.IRON)).setUnlocalizedName("hatchetIron"));
  1436.         registerItem(259, "flint_and_steel", (new ItemFlintAndSteel()).setUnlocalizedName("flintAndSteel"));
  1437.         registerItem(260, "apple", (new ItemFood(4, 0.3F, false)).setUnlocalizedName("apple"));
  1438.         registerItem(261, "bow", (new ItemBow()).setUnlocalizedName("bow"));
  1439.         registerItem(262, "arrow", (new Item()).setUnlocalizedName("arrow").setCreativeTab(CreativeTabs.tabCombat));
  1440.         registerItem(263, "coal", (new ItemCoal()).setUnlocalizedName("coal"));
  1441.         registerItem(264, "diamond", (new Item()).setUnlocalizedName("diamond").setCreativeTab(CreativeTabs.tabMaterials));
  1442.         registerItem(265, "iron_ingot", (new Item()).setUnlocalizedName("ingotIron").setCreativeTab(CreativeTabs.tabMaterials));
  1443.         registerItem(266, "gold_ingot", (new Item()).setUnlocalizedName("ingotGold").setCreativeTab(CreativeTabs.tabMaterials));
  1444.         registerItem(267, "iron_sword", (new ItemSword(Item.ToolMaterial.IRON)).setUnlocalizedName("swordIron"));
  1445.         registerItem(268, "wooden_sword", (new ItemSword(Item.ToolMaterial.WOOD)).setUnlocalizedName("swordWood"));
  1446.         registerItem(269, "wooden_shovel", (new ItemSpade(Item.ToolMaterial.WOOD)).setUnlocalizedName("shovelWood"));
  1447.         registerItem(270, "wooden_pickaxe", (new ItemPickaxe(Item.ToolMaterial.WOOD)).setUnlocalizedName("pickaxeWood"));
  1448.         registerItem(271, "wooden_axe", (new ItemAxe(Item.ToolMaterial.WOOD)).setUnlocalizedName("hatchetWood"));
  1449.         registerItem(272, "stone_sword", (new ItemSword(Item.ToolMaterial.STONE)).setUnlocalizedName("swordStone"));
  1450.         registerItem(273, "stone_shovel", (new ItemSpade(Item.ToolMaterial.STONE)).setUnlocalizedName("shovelStone"));
  1451.         registerItem(274, "stone_pickaxe", (new ItemPickaxe(Item.ToolMaterial.STONE)).setUnlocalizedName("pickaxeStone"));
  1452.         registerItem(275, "stone_axe", (new ItemAxe(Item.ToolMaterial.STONE)).setUnlocalizedName("hatchetStone"));
  1453.         registerItem(276, "diamond_sword", (new ItemSword(Item.ToolMaterial.EMERALD)).setUnlocalizedName("swordDiamond"));
  1454.         registerItem(277, "diamond_shovel", (new ItemSpade(Item.ToolMaterial.EMERALD)).setUnlocalizedName("shovelDiamond"));
  1455.         registerItem(278, "diamond_pickaxe", (new ItemPickaxe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("pickaxeDiamond"));
  1456.         registerItem(279, "diamond_axe", (new ItemAxe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("hatchetDiamond"));
  1457.         registerItem(280, "stick", (new Item()).setFull3D().setUnlocalizedName("stick").setCreativeTab(CreativeTabs.tabMaterials));
  1458.         registerItem(281, "bowl", (new Item()).setUnlocalizedName("bowl").setCreativeTab(CreativeTabs.tabMaterials));
  1459.         registerItem(282, "mushroom_stew", (new ItemSoup(6)).setUnlocalizedName("mushroomStew"));
  1460.         registerItem(283, "golden_sword", (new ItemSword(Item.ToolMaterial.GOLD)).setUnlocalizedName("swordGold"));
  1461.         registerItem(284, "golden_shovel", (new ItemSpade(Item.ToolMaterial.GOLD)).setUnlocalizedName("shovelGold"));
  1462.         registerItem(285, "golden_pickaxe", (new ItemPickaxe(Item.ToolMaterial.GOLD)).setUnlocalizedName("pickaxeGold"));
  1463.         registerItem(286, "golden_axe", (new ItemAxe(Item.ToolMaterial.GOLD)).setUnlocalizedName("hatchetGold"));
  1464.         registerItem(287, "string", (new ItemReed(Blocks.tripwire)).setUnlocalizedName("string").setCreativeTab(CreativeTabs.tabMaterials));
  1465.         registerItem(288, "feather", (new Item()).setUnlocalizedName("feather").setCreativeTab(CreativeTabs.tabMaterials));
  1466.         registerItem(289, "gunpowder", (new Item()).setUnlocalizedName("sulphur").setPotionEffect(PotionHelper.gunpowderEffect).setCreativeTab(CreativeTabs.tabMaterials));
  1467.         registerItem(290, "wooden_hoe", (new ItemHoe(Item.ToolMaterial.WOOD)).setUnlocalizedName("hoeWood"));
  1468.         registerItem(291, "stone_hoe", (new ItemHoe(Item.ToolMaterial.STONE)).setUnlocalizedName("hoeStone"));
  1469.         registerItem(292, "iron_hoe", (new ItemHoe(Item.ToolMaterial.IRON)).setUnlocalizedName("hoeIron"));
  1470.         registerItem(293, "diamond_hoe", (new ItemHoe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("hoeDiamond"));
  1471.         registerItem(294, "golden_hoe", (new ItemHoe(Item.ToolMaterial.GOLD)).setUnlocalizedName("hoeGold"));
  1472.         registerItem(295, "wheat_seeds", (new ItemSeeds(Blocks.wheat, Blocks.farmland)).setUnlocalizedName("seeds"));
  1473.         registerItem(296, "wheat", (new Item()).setUnlocalizedName("wheat").setCreativeTab(CreativeTabs.tabMaterials));
  1474.         registerItem(297, "bread", (new ItemFood(5, 0.6F, false)).setUnlocalizedName("bread"));
  1475.         registerItem(298, "leather_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 0)).setUnlocalizedName("helmetCloth"));
  1476.         registerItem(299, "leather_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 1)).setUnlocalizedName("chestplateCloth"));
  1477.         registerItem(300, "leather_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 2)).setUnlocalizedName("leggingsCloth"));
  1478.         registerItem(301, "leather_boots", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 3)).setUnlocalizedName("bootsCloth"));
  1479.         registerItem(302, "chainmail_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 0)).setUnlocalizedName("helmetChain"));
  1480.         registerItem(303, "chainmail_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 1)).setUnlocalizedName("chestplateChain"));
  1481.         registerItem(304, "chainmail_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 2)).setUnlocalizedName("leggingsChain"));
  1482.         registerItem(305, "chainmail_boots", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 3)).setUnlocalizedName("bootsChain"));
  1483.         registerItem(306, "iron_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 0)).setUnlocalizedName("helmetIron"));
  1484.         registerItem(307, "iron_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 1)).setUnlocalizedName("chestplateIron"));
  1485.         registerItem(308, "iron_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 2)).setUnlocalizedName("leggingsIron"));
  1486.         registerItem(309, "iron_boots", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 3)).setUnlocalizedName("bootsIron"));
  1487.         registerItem(310, "diamond_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 0)).setUnlocalizedName("helmetDiamond"));
  1488.         registerItem(311, "diamond_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 1)).setUnlocalizedName("chestplateDiamond"));
  1489.         registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 2)).setUnlocalizedName("leggingsDiamond"));
  1490.         registerItem(313, "diamond_boots", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 3)).setUnlocalizedName("bootsDiamond"));
  1491.         registerItem(314, "golden_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 0)).setUnlocalizedName("helmetGold"));
  1492.         registerItem(315, "golden_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 1)).setUnlocalizedName("chestplateGold"));
  1493.         registerItem(316, "golden_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 2)).setUnlocalizedName("leggingsGold"));
  1494.         registerItem(317, "golden_boots", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 3)).setUnlocalizedName("bootsGold"));
  1495.         registerItem(318, "flint", (new Item()).setUnlocalizedName("flint").setCreativeTab(CreativeTabs.tabMaterials));
  1496.         registerItem(319, "porkchop", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("porkchopRaw"));
  1497.         registerItem(320, "cooked_porkchop", (new ItemFood(8, 0.8F, true)).setUnlocalizedName("porkchopCooked"));
  1498.         registerItem(321, "painting", (new ItemHangingEntity(EntityPainting.class)).setUnlocalizedName("painting"));
  1499.         registerItem(322, "golden_apple", (new ItemAppleGold(4, 1.2F, false)).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 5, 1, 1.0F).setUnlocalizedName("appleGold"));
  1500.         registerItem(323, "sign", (new ItemSign()).setUnlocalizedName("sign"));
  1501.         registerItem(324, "wooden_door", (new ItemDoor(Blocks.oak_door)).setUnlocalizedName("doorOak"));
  1502.         Item item = (new ItemBucket(Blocks.air)).setUnlocalizedName("bucket").setMaxStackSize(16);
  1503.         registerItem(325, "bucket", item);
  1504.         registerItem(326, "water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(item));
  1505.         registerItem(327, "lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(item));
  1506.         registerItem(328, "minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.RIDEABLE)).setUnlocalizedName("minecart"));
  1507.         registerItem(329, "saddle", (new ItemSaddle()).setUnlocalizedName("saddle"));
  1508.         registerItem(330, "iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron"));
  1509.         registerItem(331, "redstone", (new ItemRedstone()).setUnlocalizedName("redstone").setPotionEffect(PotionHelper.redstoneEffect));
  1510.         registerItem(332, "snowball", (new ItemSnowball()).setUnlocalizedName("snowball"));
  1511.         registerItem(333, "boat", (new ItemBoat()).setUnlocalizedName("boat"));
  1512.         registerItem(334, "leather", (new Item()).setUnlocalizedName("leather").setCreativeTab(CreativeTabs.tabMaterials));
  1513.         registerItem(335, "milk_bucket", (new ItemBucketMilk()).setUnlocalizedName("milk").setContainerItem(item));
  1514.         registerItem(336, "brick", (new Item()).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabMaterials));
  1515.         registerItem(337, "clay_ball", (new Item()).setUnlocalizedName("clay").setCreativeTab(CreativeTabs.tabMaterials));
  1516.         registerItem(338, "reeds", (new ItemReed(Blocks.reeds)).setUnlocalizedName("reeds").setCreativeTab(CreativeTabs.tabMaterials));
  1517.         registerItem(339, "paper", (new Item()).setUnlocalizedName("paper").setCreativeTab(CreativeTabs.tabMisc));
  1518.         registerItem(340, "book", (new ItemBook()).setUnlocalizedName("book").setCreativeTab(CreativeTabs.tabMisc));
  1519.         registerItem(341, "slime_ball", (new Item()).setUnlocalizedName("slimeball").setCreativeTab(CreativeTabs.tabMisc));
  1520.         registerItem(342, "chest_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.CHEST)).setUnlocalizedName("minecartChest"));
  1521.         registerItem(343, "furnace_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.FURNACE)).setUnlocalizedName("minecartFurnace"));
  1522.         registerItem(344, "egg", (new ItemEgg()).setUnlocalizedName("egg"));
  1523.         registerItem(345, "compass", (new Item()).setUnlocalizedName("compass").setCreativeTab(CreativeTabs.tabTools));
  1524.         registerItem(346, "fishing_rod", (new ItemFishingRod()).setUnlocalizedName("fishingRod"));
  1525.         registerItem(347, "clock", (new Item()).setUnlocalizedName("clock").setCreativeTab(CreativeTabs.tabTools));
  1526.         registerItem(348, "glowstone_dust", (new Item()).setUnlocalizedName("yellowDust").setPotionEffect(PotionHelper.glowstoneEffect).setCreativeTab(CreativeTabs.tabMaterials));
  1527.         registerItem(349, "fish", (new ItemFishFood(false)).setUnlocalizedName("fish").setHasSubtypes(true));
  1528.         registerItem(350, "cooked_fish", (new ItemFishFood(true)).setUnlocalizedName("fish").setHasSubtypes(true));
  1529.         registerItem(351, "dye", (new ItemDye()).setUnlocalizedName("dyePowder"));
  1530.         registerItem(352, "bone", (new Item()).setUnlocalizedName("bone").setFull3D().setCreativeTab(CreativeTabs.tabMisc));
  1531.         registerItem(353, "sugar", (new Item()).setUnlocalizedName("sugar").setPotionEffect(PotionHelper.sugarEffect).setCreativeTab(CreativeTabs.tabMaterials));
  1532.         registerItem(354, "cake", (new ItemReed(Blocks.cake)).setMaxStackSize(1).setUnlocalizedName("cake").setCreativeTab(CreativeTabs.tabFood));
  1533.         registerItem(355, "bed", (new ItemBed()).setMaxStackSize(1).setUnlocalizedName("bed"));
  1534.         registerItem(356, "repeater", (new ItemReed(Blocks.unpowered_repeater)).setUnlocalizedName("diode").setCreativeTab(CreativeTabs.tabRedstone));
  1535.         registerItem(357, "cookie", (new ItemFood(2, 0.1F, false)).setUnlocalizedName("cookie"));
  1536.         registerItem(358, "filled_map", (new ItemMap()).setUnlocalizedName("map"));
  1537.         registerItem(359, "shears", (new ItemShears()).setUnlocalizedName("shears"));
  1538.         registerItem(360, "melon", (new ItemFood(2, 0.3F, false)).setUnlocalizedName("melon"));
  1539.         registerItem(361, "pumpkin_seeds", (new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setUnlocalizedName("seeds_pumpkin"));
  1540.         registerItem(362, "melon_seeds", (new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setUnlocalizedName("seeds_melon"));
  1541.         registerItem(363, "beef", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("beefRaw"));
  1542.         registerItem(364, "cooked_beef", (new ItemFood(8, 0.8F, true)).setUnlocalizedName("beefCooked"));
  1543.         registerItem(365, "chicken", (new ItemFood(2, 0.3F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setUnlocalizedName("chickenRaw"));
  1544.         registerItem(366, "cooked_chicken", (new ItemFood(6, 0.6F, true)).setUnlocalizedName("chickenCooked"));
  1545.         registerItem(367, "rotten_flesh", (new ItemFood(4, 0.1F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.8F).setUnlocalizedName("rottenFlesh"));
  1546.         registerItem(368, "ender_pearl", (new ItemEnderPearl()).setUnlocalizedName("enderPearl"));
  1547.         registerItem(369, "blaze_rod", (new Item()).setUnlocalizedName("blazeRod").setCreativeTab(CreativeTabs.tabMaterials).setFull3D());
  1548.         registerItem(370, "ghast_tear", (new Item()).setUnlocalizedName("ghastTear").setPotionEffect(PotionHelper.ghastTearEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1549.         registerItem(371, "gold_nugget", (new Item()).setUnlocalizedName("goldNugget").setCreativeTab(CreativeTabs.tabMaterials));
  1550.         registerItem(372, "nether_wart", (new ItemSeeds(Blocks.nether_wart, Blocks.soul_sand)).setUnlocalizedName("netherStalkSeeds").setPotionEffect("+4"));
  1551.         registerItem(373, "potion", (new ItemPotion()).setUnlocalizedName("potion"));
  1552.         registerItem(374, "glass_bottle", (new ItemGlassBottle()).setUnlocalizedName("glassBottle"));
  1553.         registerItem(375, "spider_eye", (new ItemFood(2, 0.8F, false)).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setUnlocalizedName("spiderEye").setPotionEffect(PotionHelper.spiderEyeEffect));
  1554.         registerItem(376, "fermented_spider_eye", (new Item()).setUnlocalizedName("fermentedSpiderEye").setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1555.         registerItem(377, "blaze_powder", (new Item()).setUnlocalizedName("blazePowder").setPotionEffect(PotionHelper.blazePowderEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1556.         registerItem(378, "magma_cream", (new Item()).setUnlocalizedName("magmaCream").setPotionEffect(PotionHelper.magmaCreamEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1557.         registerItem(379, "brewing_stand", (new ItemReed(Blocks.brewing_stand)).setUnlocalizedName("brewingStand").setCreativeTab(CreativeTabs.tabBrewing));
  1558.         registerItem(380, "cauldron", (new ItemReed(Blocks.cauldron)).setUnlocalizedName("cauldron").setCreativeTab(CreativeTabs.tabBrewing));
  1559.         registerItem(381, "ender_eye", (new ItemEnderEye()).setUnlocalizedName("eyeOfEnder"));
  1560.         registerItem(382, "speckled_melon", (new Item()).setUnlocalizedName("speckledMelon").setPotionEffect(PotionHelper.speckledMelonEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1561.         registerItem(383, "spawn_egg", (new ItemMonsterPlacer()).setUnlocalizedName("monsterPlacer"));
  1562.         registerItem(384, "experience_bottle", (new ItemExpBottle()).setUnlocalizedName("expBottle"));
  1563.         registerItem(385, "fire_charge", (new ItemFireball()).setUnlocalizedName("fireball"));
  1564.         registerItem(386, "writable_book", (new ItemWritableBook()).setUnlocalizedName("writingBook").setCreativeTab(CreativeTabs.tabMisc));
  1565.         registerItem(387, "written_book", (new ItemEditableBook()).setUnlocalizedName("writtenBook").setMaxStackSize(16));
  1566.         registerItem(388, "emerald", (new Item()).setUnlocalizedName("emerald").setCreativeTab(CreativeTabs.tabMaterials));
  1567.         registerItem(389, "item_frame", (new ItemHangingEntity(EntityItemFrame.class)).setUnlocalizedName("frame"));
  1568.         registerItem(390, "flower_pot", (new ItemReed(Blocks.flower_pot)).setUnlocalizedName("flowerPot").setCreativeTab(CreativeTabs.tabDecorations));
  1569.         registerItem(391, "carrot", (new ItemSeedFood(3, 0.6F, Blocks.carrots, Blocks.farmland)).setUnlocalizedName("carrots"));
  1570.         registerItem(392, "potato", (new ItemSeedFood(1, 0.3F, Blocks.potatoes, Blocks.farmland)).setUnlocalizedName("potato"));
  1571.         registerItem(393, "baked_potato", (new ItemFood(5, 0.6F, false)).setUnlocalizedName("potatoBaked"));
  1572.         registerItem(394, "poisonous_potato", (new ItemFood(2, 0.3F, false)).setPotionEffect(Potion.poison.id, 5, 0, 0.6F).setUnlocalizedName("potatoPoisonous"));
  1573.         registerItem(395, "map", (new ItemEmptyMap()).setUnlocalizedName("emptyMap"));
  1574.         registerItem(396, "golden_carrot", (new ItemFood(6, 1.2F, false)).setUnlocalizedName("carrotGolden").setPotionEffect(PotionHelper.goldenCarrotEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1575.         registerItem(397, "skull", (new ItemSkull()).setUnlocalizedName("skull"));
  1576.         registerItem(398, "carrot_on_a_stick", (new ItemCarrotOnAStick()).setUnlocalizedName("carrotOnAStick"));
  1577.         registerItem(399, "nether_star", (new ItemSimpleFoiled()).setUnlocalizedName("netherStar").setCreativeTab(CreativeTabs.tabMaterials));
  1578.         registerItem(400, "pumpkin_pie", (new ItemFood(8, 0.3F, false)).setUnlocalizedName("pumpkinPie").setCreativeTab(CreativeTabs.tabFood));
  1579.         registerItem(401, "fireworks", (new ItemFirework()).setUnlocalizedName("fireworks"));
  1580.         registerItem(402, "firework_charge", (new ItemFireworkCharge()).setUnlocalizedName("fireworksCharge").setCreativeTab(CreativeTabs.tabMisc));
  1581.         registerItem(403, "enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setUnlocalizedName("enchantedBook"));
  1582.         registerItem(404, "comparator", (new ItemReed(Blocks.unpowered_comparator)).setUnlocalizedName("comparator").setCreativeTab(CreativeTabs.tabRedstone));
  1583.         registerItem(405, "netherbrick", (new Item()).setUnlocalizedName("netherbrick").setCreativeTab(CreativeTabs.tabMaterials));
  1584.         registerItem(406, "quartz", (new Item()).setUnlocalizedName("netherquartz").setCreativeTab(CreativeTabs.tabMaterials));
  1585.         registerItem(407, "tnt_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.TNT)).setUnlocalizedName("minecartTnt"));
  1586.         registerItem(408, "hopper_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.HOPPER)).setUnlocalizedName("minecartHopper"));
  1587.         registerItem(409, "prismarine_shard", (new Item()).setUnlocalizedName("prismarineShard").setCreativeTab(CreativeTabs.tabMaterials));
  1588.         registerItem(410, "prismarine_crystals", (new Item()).setUnlocalizedName("prismarineCrystals").setCreativeTab(CreativeTabs.tabMaterials));
  1589.         registerItem(411, "rabbit", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("rabbitRaw"));
  1590.         registerItem(412, "cooked_rabbit", (new ItemFood(5, 0.6F, true)).setUnlocalizedName("rabbitCooked"));
  1591.         registerItem(413, "rabbit_stew", (new ItemSoup(10)).setUnlocalizedName("rabbitStew"));
  1592.         registerItem(414, "rabbit_foot", (new Item()).setUnlocalizedName("rabbitFoot").setPotionEffect(PotionHelper.rabbitFootEffect).setCreativeTab(CreativeTabs.tabBrewing));
  1593.         registerItem(415, "rabbit_hide", (new Item()).setUnlocalizedName("rabbitHide").setCreativeTab(CreativeTabs.tabMaterials));
  1594.         registerItem(416, "armor_stand", (new ItemArmorStand()).setUnlocalizedName("armorStand").setMaxStackSize(16));
  1595.         registerItem(417, "iron_horse_armor", (new Item()).setUnlocalizedName("horsearmormetal").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc));
  1596.         registerItem(418, "golden_horse_armor", (new Item()).setUnlocalizedName("horsearmorgold").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc));
  1597.         registerItem(419, "diamond_horse_armor", (new Item()).setUnlocalizedName("horsearmordiamond").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc));
  1598.         registerItem(420, "lead", (new ItemLead()).setUnlocalizedName("leash"));
  1599.         registerItem(421, "name_tag", (new ItemNameTag()).setUnlocalizedName("nameTag"));
  1600.         registerItem(422, "command_block_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.COMMAND_BLOCK)).setUnlocalizedName("minecartCommandBlock").setCreativeTab((CreativeTabs)null));
  1601.         registerItem(423, "mutton", (new ItemFood(2, 0.3F, true)).setUnlocalizedName("muttonRaw"));
  1602.         registerItem(424, "cooked_mutton", (new ItemFood(6, 0.8F, true)).setUnlocalizedName("muttonCooked"));
  1603.         registerItem(425, "banner", (new ItemBanner()).setUnlocalizedName("banner"));
  1604.         registerItem(427, "spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce"));
  1605.         registerItem(428, "birch_door", (new ItemDoor(Blocks.birch_door)).setUnlocalizedName("doorBirch"));
  1606.         registerItem(429, "jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle"));
  1607.         registerItem(430, "acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia"));
  1608.         registerItem(431, "dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak"));
  1609.         registerItem(2256, "record_13", (new ItemRecord("13")).setUnlocalizedName("record"));
  1610.         registerItem(2257, "record_cat", (new ItemRecord("cat")).setUnlocalizedName("record"));
  1611.         registerItem(2258, "record_blocks", (new ItemRecord("blocks")).setUnlocalizedName("record"));
  1612.         registerItem(2259, "record_chirp", (new ItemRecord("chirp")).setUnlocalizedName("record"));
  1613.         registerItem(2260, "record_far", (new ItemRecord("far")).setUnlocalizedName("record"));
  1614.         registerItem(2261, "record_mall", (new ItemRecord("mall")).setUnlocalizedName("record"));
  1615.         registerItem(2262, "record_mellohi", (new ItemRecord("mellohi")).setUnlocalizedName("record"));
  1616.         registerItem(2263, "record_stal", (new ItemRecord("stal")).setUnlocalizedName("record"));
  1617.         registerItem(2264, "record_strad", (new ItemRecord("strad")).setUnlocalizedName("record"));
  1618.         registerItem(2265, "record_ward", (new ItemRecord("ward")).setUnlocalizedName("record"));
  1619.         registerItem(2266, "record_11", (new ItemRecord("11")).setUnlocalizedName("record"));
  1620.         registerItem(2267, "record_wait", (new ItemRecord("wait")).setUnlocalizedName("record"));
  1621.     }
  1622.  
  1623.     /**
  1624.      * Register a default ItemBlock for the given Block.
  1625.      */
  1626.     private static void registerItemBlock(Block blockIn)
  1627.     {
  1628.         registerItemBlock(blockIn, new ItemBlock(blockIn));
  1629.     }
  1630.  
  1631.     /**
  1632.      * Register the given Item as the ItemBlock for the given Block.
  1633.      */
  1634.     protected static void registerItemBlock(Block blockIn, Item itemIn)
  1635.     {
  1636.         registerItem(Block.getIdFromBlock(blockIn), (ResourceLocation)Block.blockRegistry.getNameForObject(blockIn), itemIn);
  1637.         BLOCK_TO_ITEM.put(blockIn, itemIn);
  1638.     }
  1639.  
  1640.     private static void registerItem(int id, String textualID, Item itemIn)
  1641.     {
  1642.         registerItem(id, new ResourceLocation(textualID), itemIn);
  1643.     }
  1644.  
  1645.     private static void registerItem(int id, ResourceLocation textualID, Item itemIn)
  1646.     {
  1647.         itemRegistry.register(id, textualID, itemIn);
  1648.     }
  1649.  
  1650.     public static enum ToolMaterial
  1651.     {
  1652.         WOOD(0, 59, 2.0F, 0.0F, 15),
  1653.         STONE(1, 131, 4.0F, 1.0F, 5),
  1654.         IRON(2, 250, 6.0F, 2.0F, 14),
  1655.         EMERALD(3, 1561, 8.0F, 3.0F, 10),
  1656.         GOLD(0, 32, 12.0F, 0.0F, 22);
  1657.         /** The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = WOOD/GOLD) */
  1658.         private final int harvestLevel;
  1659.         /** The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) */
  1660.         private final int maxUses;
  1661.         /** The strength of this tool material against blocks which it is effective against. */
  1662.         private final float efficiencyOnProperMaterial;
  1663.         /** Damage versus entities. */
  1664.         private final float damageVsEntity;
  1665.         /** Defines the natural enchantability factor of the material. */
  1666.         private final int enchantability;
  1667.  
  1668.         private static final String __OBFID = "CL_00000042";
  1669.  
  1670.         //Added by forge for custom Tool materials.
  1671.         @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1
  1672.         private ItemStack repairMaterial = null;
  1673.  
  1674.         private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability)
  1675.         {
  1676.             this.harvestLevel = harvestLevel;
  1677.             this.maxUses = maxUses;
  1678.             this.efficiencyOnProperMaterial = efficiency;
  1679.             this.damageVsEntity = damageVsEntity;
  1680.             this.enchantability = enchantability;
  1681.         }
  1682.  
  1683.         /**
  1684.          * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
  1685.          */
  1686.         public int getMaxUses()
  1687.         {
  1688.             return this.maxUses;
  1689.         }
  1690.  
  1691.         /**
  1692.          * The strength of this tool material against blocks which it is effective against.
  1693.          */
  1694.         public float getEfficiencyOnProperMaterial()
  1695.         {
  1696.             return this.efficiencyOnProperMaterial;
  1697.         }
  1698.  
  1699.         /**
  1700.          * Returns the damage against a given entity.
  1701.          */
  1702.         public float getDamageVsEntity()
  1703.         {
  1704.             return this.damageVsEntity;
  1705.         }
  1706.  
  1707.         /**
  1708.          * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
  1709.          */
  1710.         public int getHarvestLevel()
  1711.         {
  1712.             return this.harvestLevel;
  1713.         }
  1714.  
  1715.         /**
  1716.          * Return the natural enchantability factor of the material.
  1717.          */
  1718.         public int getEnchantability()
  1719.         {
  1720.             return this.enchantability;
  1721.         }
  1722.  
  1723.         @Deprecated // Use getRepairItemStack below
  1724.         public Item getRepairItem()
  1725.         {
  1726.             switch (this)
  1727.             {
  1728.                 case WOOD:    return Item.getItemFromBlock(Blocks.planks);
  1729.                 case STONE:   return Item.getItemFromBlock(Blocks.cobblestone);
  1730.                 case GOLD:    return Items.gold_ingot;
  1731.                 case IRON:    return Items.iron_ingot;
  1732.                 case EMERALD: return Items.diamond;
  1733.                 default:      return customCraftingMaterial;
  1734.             }
  1735.         }
  1736.  
  1737.         public ToolMaterial setRepairItem(ItemStack stack)
  1738.         {
  1739.             if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material");
  1740.             if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials");
  1741.             this.repairMaterial = stack;
  1742.             this.customCraftingMaterial = stack.getItem();
  1743.             return this;
  1744.         }
  1745.  
  1746.         public ItemStack getRepairItemStack()
  1747.         {
  1748.             if (repairMaterial != null) return repairMaterial;
  1749.             Item ret = this.getRepairItem();
  1750.             if (ret == null) return null;
  1751.             repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE);
  1752.             return repairMaterial;
  1753.         }
  1754.     }
  1755. }
Advertisement
Add Comment
Please, Sign In to add comment