RecipeUtils.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package me.km.utils;
  2. /*import java.util.ArrayList;
  3. import java.util.List;
  4. import net.minecraft.item.ItemStack;
  5. import net.minecraft.item.crafting.CraftingManager;
  6. import net.minecraft.item.crafting.FurnaceRecipes;
  7. import net.minecraft.item.crafting.IRecipe;*/
  8. public class RecipeUtils
  9. {
  10. /*private static final ArrayList<IRecipe> RECIPES = new ArrayList<>();
  11. private static void pushLastRecipe()
  12. {
  13. List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
  14. RECIPES.add(list.get(list.size() - 1));
  15. }
  16. public static void registerShapelessRecipe(ItemStack result, ItemStack[] stacks)
  17. {
  18. CraftingManager.getInstance().addShapelessRecipe(result, (Object[]) stacks);
  19. pushLastRecipe();
  20. }
  21. public static void registerShapedRecipe(ItemStack result, String[] s, ItemStack[] stacks)
  22. {
  23. int length = s.length;
  24. Object[] o = new Object[length + (stacks.length * 2)];
  25. System.arraycopy(s, 0, o, 0, length);
  26. for(int i = length; i < o.length; i += 2)
  27. {
  28. o[i] = Character.forDigit(i + 1 - length, 10);
  29. o[i + 1] = stacks[i - length];
  30. }
  31. CraftingManager.getInstance().addRecipe(result, o);
  32. pushLastRecipe();
  33. }
  34. public static void registerFurnaceRecipe(ItemStack result, ItemStack input)
  35. {
  36. FurnaceRecipes.instance().addSmeltingRecipe(input, result, 0.1F);
  37. }
  38. public static void clearRecipes()
  39. {
  40. CraftingManager.getInstance().getRecipeList().removeAll(RECIPES);
  41. RECIPES.clear();
  42. }*/
  43. }