Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1.  
  2. package com.nathan72419.SingularityUtil.misc;
  3.  
  4.  
  5. import java.util.Iterator;
  6. import java.util.List;
  7. import java.util.Map;
  8. import java.util.Map.Entry;
  9.  
  10. import com.nathan72419.SingularityUtil.core.CommonProxy;
  11.  
  12. import net.minecraft.block.Block;
  13. import net.minecraft.item.Item;
  14. import net.minecraft.item.ItemStack;
  15. import net.minecraft.item.crafting.CraftingManager;
  16. import net.minecraft.item.crafting.FurnaceRecipes;
  17. import net.minecraft.item.crafting.IRecipe;
  18.  
  19. public class RecipeRemover {
  20. public static void removeRecipe (Item item) {
  21. List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
  22.  
  23. Iterator<IRecipe> remover = recipes.iterator();
  24.  
  25. while(remover.hasNext()) {
  26. ItemStack itemstack = remover.next().getRecipeOutput();
  27. if(itemstack != null && itemstack.getItem() == item)
  28. remover.remove();
  29. }}
  30. public static void removeRecipe (Block block) {
  31. List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
  32.  
  33. Iterator<IRecipe> remover = recipes.iterator();
  34.  
  35. while(remover.hasNext()) {
  36. ItemStack itemstack = remover.next().getRecipeOutput();
  37. if(itemstack != null && itemstack.getItem() == Item.getItemFromBlock(block));{
  38. remover.remove();
  39. }}
  40. }
  41. public static void removeSmeltingInput (ItemStack stack) {
  42.  
  43. Map recipes = FurnaceRecipes.smelting().getSmeltingList();
  44. Iterator remover = recipes.entrySet().iterator();
  45. while(remover.hasNext()) {
  46. Map.Entry delEntry = (Map.Entry) remover.next();
  47. CommonProxy.logger.info(delEntry.getKey() + "=" + delEntry.getValue());
  48. boolean run = false;
  49. if(ItemStack.areItemStacksEqual(stack, (ItemStack) delEntry.getKey())){
  50. remover.remove();
  51. run = true;
  52.  
  53. }
  54. if(run=true){CommonProxy.logger.info("run = " + run);}
  55.  
  56. }
  57. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement