SHARE
TWEET

Untitled

a guest Aug 19th, 2018 68 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.  
  16. public class TransformatorRecipes
  17. {
  18.      private static final TransformatorRecipes smeltingBase = new TransformatorRecipes();
  19.         private Map smeltingList = new HashMap();
  20.         {
  21.             this.addRecipe(Items.coal, Items.iron_ingot, lezinkmod.obsidian_compacted , new ItemStack(lezinkmod.titane_fragment));
  22.  
  23.         }
  24.         public void addRecipe(ItemStack stack1, ItemStack stack2, ItemStack stack3, ItemStack stack4)
  25.         {
  26.             ItemStack[] stackList = new ItemStack[]{stack1, stack2, stack3};
  27.             this.smeltingList.put(stackList, stack4);
  28.         }
  29.  
  30.             private void addRecipe(Item coal, Item iron, Block obsidian_compacted, ItemStack stack) {
  31.                 this.addRecipe(new ItemStack(coal), new ItemStack(iron), new ItemStack(obsidian_compacted), stack);
  32.  
  33.         }
  34.         public ItemStack getSmeltingResult(ItemStack[] stack)
  35.         {
  36.             Iterator iterator = this.smeltingList.entrySet().iterator();
  37.             Entry entry;
  38.  
  39.             do
  40.             {
  41.                 if (!iterator.hasNext())
  42.                 {
  43.                     return null;
  44.                 }
  45.             entry = (Entry)iterator.next();
  46.         }
  47.         while (!this.isSameKey(stack, (ItemStack[])entry.getKey()));
  48.  
  49.         return (ItemStack)entry.getValue();
  50.         }
  51.         private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
  52.         {
  53.             boolean isSame = false;
  54.             for(int i=0; i<=2; i++)
  55.             {
  56.                 if(stackList.length == stackList2.length)
  57.                 {
  58.                     isSame = true;
  59.                 }
  60.                 else
  61.                 {
  62.                     return false;
  63.                 }
  64.             }
  65.             return isSame;
  66.         }
  67.         public Map getSmeltingList()
  68.         {
  69.             return this.smeltingList;
  70.         }
  71.  
  72.         public static TransformatorRecipes smelting()
  73.         {
  74.             return smeltingBase;
  75.         }
  76. }
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