SHARE
TWEET

Untitled

a guest Aug 19th, 2018 62 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.block.material.Material;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.init.Blocks;
  12. import net.minecraft.init.Items;
  13. import net.minecraft.item.Item;
  14. import net.minecraft.item.ItemStack;
  15. import net.minecraft.world.World;
  16.  
  17.  
  18. public class CompactorRecipes
  19. {
  20.  
  21. private static final CompactorRecipes smeltingBase = new CompactorRecipes();
  22. private Map smeltingList = new HashMap();
  23. {
  24.     this.addRecipe(Blocks.obsidian, new ItemStack(lezinkmod.obsidian_compacted));
  25.  
  26. }
  27.      public void addRecipe(Block obsidian, ItemStack itemStack)
  28.      {
  29.          this.addRecipe(Item.getItemFromBlock(obsidian), itemStack);
  30.      }
  31.  
  32.     private void addRecipe(Item itemFromBlock, ItemStack itemStack) {
  33.           this.addRecipe(itemFromBlock, itemStack);    
  34.     }
  35.  
  36.     public ItemStack getSmeltingResult(ItemStack[] stack)
  37.         {
  38.             Iterator iterator = this.smeltingList.entrySet().iterator();
  39.             Entry entry;
  40.  
  41.             do
  42.             {
  43.                 if (!iterator.hasNext())
  44.                 {
  45.                     return null;
  46.                 }
  47.             entry = (Entry)iterator.next();
  48.         }
  49.         while (!this.isSameKey(stack, (ItemStack[])entry.getKey()));
  50.  
  51.         return (ItemStack)entry.getValue();
  52.         }
  53.        
  54.        
  55.         private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
  56.         {
  57.             boolean isSame = false;
  58.             for(int i=0; i<=1; i++)
  59.             {
  60.                 if(stackList.length == stackList2.length)
  61.                 {
  62.                     isSame = true;
  63.                 }
  64.                 else
  65.                 {
  66.                     return false;
  67.                 }
  68.             }
  69.             return isSame;
  70.         }
  71.         public Map getSmeltingList()
  72.         {
  73.             return this.smeltingList;
  74.         }
  75.  
  76.         public static CompactorRecipes smelting()
  77.         {
  78.             return smeltingBase;
  79.         }
  80.        
  81. }
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