Guest User

Untitled

a guest
Aug 25th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.76 KB | None | 0 0
  1. package wintercraft.helper.gui;
  2.  
  3. import java.util.Arrays;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemStack;
  11.  
  12. public class FreezerRecipes
  13. {
  14. private static final FreezerRecipes smeltingBase = new FreezerRecipes();
  15. private HashMap<List<Integer>, ItemStack> metaSmeltingList = new HashMap<List<Integer>, ItemStack>();
  16. private Map smeltingList = new HashMap();
  17. private HashMap<List<Integer>, Float> metaExperience = new HashMap<List<Integer>, Float>();
  18.  
  19. /**
  20. * Used to call methods addInscribing and getInscribingResult.
  21. */
  22. public static final FreezerRecipes smelting() {
  23.     return smeltingBase;
  24. }
  25.  
  26.  
  27. /**
  28. * Adds all recipes to the HashMap
  29. */
  30. private FreezerRecipes()
  31. {
  32.     //this.addSmelting(Arrays.asList(Item.sugar.itemID, 0, Item.bucketMilk.itemID, 0), new ItemStack(Items.commonItem.itemID, 4, 1), 0.3F);
  33.     //this.addSmelting(Arrays.asList(Items.commonItem.itemID, 1, Item.dyePowder.itemID, 3), new ItemStack(Items.commonItem.itemID, 1, 2), 0.3F);
  34.     this.addSmelting(Arrays.asList(Item.bucketWater.itemID, 0, Item.bucketWater.itemID, 0), new ItemStack(Block.ice.blockID, 4, 0), 0.2F);
  35.     //this.addSmelting(Arrays.asList(Items.commonItem.itemID, 1, Item.dyePowder.itemID, 1), new ItemStack(Items.commonItem.itemID, 1, 3), 0.3F);
  36.     //this.addSmelting(Arrays.asList(Items.commonItem.itemID, 1, Item.cookie.itemID, 0), new ItemStack(Items.commonItem.itemID, 1, 4), 0.3F);
  37.     //this.addSmelting(Arrays.asList(Items.commonItem.itemID, 1, Item.magmaCream.itemID, 0), new ItemStack(Items.commonItem.itemID, 1, 5), 0.3F);
  38.     //this.addSmelting(Arrays.asList(Items.rockySnowball.itemID, 0, Items.rockySnowball.itemID, 0), new ItemStack(Items.iceBall.itemID, 2, 0), 0.2F);
  39.     //this.addSmelting(Arrays.asList(Items.iceChunk.itemID, 0, Items.iceGem.itemID, 0), new ItemStack(Items.iceGem.itemID, 1, 1), 0.7F);
  40.     //this.addSmelting(Arrays.asList(Items.iceChunk.itemID, 0, Block.stone.blockID, 0), new ItemStack(Blocks.icedStone.blockID, 1, 0), 0.4F);
  41.     //this.addSmelting(Arrays.asList(Items.iceChunk.itemID, 0, Item.ingotIron.itemID, 0), new ItemStack(Items.iceIngot.itemID, 1, 0), 0.4F);
  42.     //this.addSmelting(Arrays.asList(Items.iceChunk.itemID, 0, Item.diamond.itemID, 0), new ItemStack(Items.iceCrystal.itemID, 1, 0), 0.4F);
  43. }
  44.  
  45. public void addSmelting(List<Integer> items, ItemStack out, float experience)
  46. {
  47.     metaSmeltingList.put(items, out);
  48.     metaExperience.put(Arrays.asList(out.itemID, out.getItemDamage()), experience);
  49. }
  50.  
  51. /**
  52.  * Used to get the resulting ItemStack form a source ItemStack
  53.  * @param item The Source ItemStack
  54.  * @return The result ItemStack
  55.  */
  56. public ItemStack getSmeltingResult(ItemStack item, ItemStack item2)
  57. {
  58.         if (item==null||item2==null)
  59.         {
  60.                 return null;
  61.         }
  62.         ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage(), item2.itemID, item2.getItemDamage()));
  63.         if (ret != null)
  64.         {
  65.                 return ret;
  66.         }
  67.         return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
  68. }
  69.  
  70. /**
  71. * Grabs the amount of base experience for this item to give when pulled from the furnace slot.
  72. */
  73. public float getExperience(ItemStack item)
  74. {
  75.     if (item == null || item.getItem() == null)
  76.     {
  77.         return 0;
  78.     }
  79.     float ret = -1; // value returned by "item.getItem().getSmeltingExperience(item);" when item doesn't specify experience to give
  80.     if (ret < 0 && metaExperience.containsKey(Arrays.asList(item.itemID, item.getItemDamage())))
  81.     {
  82.         ret = metaExperience.get(Arrays.asList(item.itemID, item.getItemDamage()));
  83.     }
  84.  
  85. return (ret < 0 ? 0 : ret);
  86. }
  87.  
  88. public Map<List<Integer>, ItemStack> getMetaInscribingList()
  89.     {
  90.         return metaSmeltingList;
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment