SHARE
TWEET

Untitled

a guest Aug 17th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.lezink.lezinkmod.common;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Iterator;
  5. import java.util.Map;
  6. import java.util.Map.Entry;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.init.Items;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13.  
  14.  
  15. public class TransformatorRecipes
  16. {
  17.      private static final TransformatorRecipes smeltingBase = new TransformatorRecipes();
  18.         private Map smeltingList = new HashMap();
  19.         {
  20.             this.addRecipe(Items.coal, Items.iron_ingot, lezinkmod.obsidian_compacted , new ItemStack(lezinkmod.titane_fragment));
  21.  
  22.         }
  23.         private void addRecipe(ItemStack stack1, ItemStack stack2, ItemStack stack3, ItemStack stack4)
  24.         {
  25.             ItemStack[] stackList = new ItemStack[]{stack1, stack2, stack3};
  26.             this.smeltingList.put(stackList, stack4);
  27.         }
  28.  
  29.             private void addRecipe(Item coal, Item iron, Block obsidian_compacted, ItemStack stack) {
  30.                 this.addRecipe(new ItemStack(coal), new ItemStack(iron), new ItemStack(obsidian_compacted), stack);
  31.  
  32.         }
  33.         public ItemStack getSmeltingResult(ItemStack[] stack)
  34.         {
  35.             Iterator iterator = this.smeltingList.entrySet().iterator();
  36.             Entry entry;
  37.  
  38.             do
  39.             {
  40.                 if (!iterator.hasNext())
  41.                 {
  42.                     return null;
  43.                 }
  44.             entry = (Entry)iterator.next();
  45.         }
  46.         while (!this.isSameKey(stack, (ItemStack[])entry.getKey()));
  47.  
  48.         return (ItemStack)entry.getValue();
  49.         }
  50.         private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
  51.         {
  52.             boolean isSame = false;
  53.             for(int i=0; i<=2; i++)
  54.             {
  55.                 if(stackList.length == stackList2.length)
  56.                 {
  57.                     isSame = true;
  58.                 }
  59.                 else
  60.                 {
  61.                     return false;
  62.                 }
  63.             }
  64.             return isSame;
  65.         }
  66.         public Map getSmeltingList()
  67.         {
  68.             return this.smeltingList;
  69.         }
  70.  
  71.         public static TransformatorRecipes smelting()
  72.         {
  73.             return smeltingBase;
  74.         }
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top