Advertisement
Guest User

Untitled

a guest
Aug 6th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. /*
  2. * The MIT License (MIT)
  3. * Copyright (c) 2016 shredder8910
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. * IN THE SOFTWARE.
  21. */
  22.  
  23. package us.raego.jakescraftingessentials.recipes;
  24.  
  25. import net.minecraft.init.Items;
  26. import net.minecraft.item.ItemStack;
  27. import net.minecraft.item.crafting.IRecipe;
  28. import net.minecraftforge.common.config.Configuration;
  29. import net.minecraftforge.oredict.ShapedOreRecipe;
  30. import us.raego.jakescraftingessentials.JakesCraftingEssentials;
  31. import us.raego.jakescraftingessentials.utils.RecipeUtils;
  32.  
  33. import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE;
  34.  
  35. public class ModRecipes {
  36. private static int GUNPOWDER_AMOUNT;
  37. private static int BLAZE_ROD_AMOUNT;
  38. private static int ENDER_PEARL_AMOUNT;
  39.  
  40. private static IRecipe gunpowderRecipe;
  41. private static IRecipe blazeRodRecipe;
  42. private static IRecipe enderPearlRecipe;
  43. private static IRecipe quartzRecipe;
  44.  
  45. public static void updateRecipesFromConfig() {
  46. GUNPOWDER_AMOUNT = JakesCraftingEssentials.config.get(Configuration.CATEGORY_GENERAL, "Gunpowder from recipe", 1);
  47. BLAZE_ROD_AMOUNT = JakesCraftingEssentials.config.get(Configuration.CATEGORY_GENERAL, "Blaze Rods from recipe", 2);
  48. ENDER_PEARL_AMOUNT = JakesCraftingEssentials.config.get(Configuration.CATEGORY_GENERAL, "Ender Pearls from recipe", 8);
  49. }
  50.  
  51. public static void registerRecipes() {
  52. updateRecipesFromConfig();
  53.  
  54. RecipeUtils.addRecipes(
  55. gunpowderRecipe = new ShapedOreRecipe(new ItemStack(Items.gunpowder, GUNPOWDER_AMOUNT),
  56. " C ",
  57. "GS ",
  58. " R ",
  59. 'C', new ItemStack(Items.coal, 1, WILDCARD_VALUE),
  60. 'G', "dustGlowstone",
  61. 'S', Items.sugar,
  62. 'R', "dustRedstone"),
  63. blazeRodRecipe = new ShapedOreRecipe(new ItemStack(Items.blaze_rod, BLAZE_ROD_AMOUNT),
  64. "CGS",
  65. "GLN",
  66. "SNC",
  67. 'C', new ItemStack(Items.coal, 1, WILDCARD_VALUE),
  68. 'G', "dustGlowstone",
  69. 'S', "stickWood",
  70. 'N', "gemQuartz",
  71. 'L', Items.lava_bucket),
  72. enderPearlRecipe = new ShapedOreRecipe(new ItemStack(Items.ender_pearl, ENDER_PEARL_AMOUNT),
  73. "LRL",
  74. "GDG",
  75. "LRL",
  76. 'L', "gemLapis",
  77. 'R', "blockRedstone",
  78. 'G', "ingotGold",
  79. 'D', "gemDiamond"),
  80. quartzRecipe = new ShapedOreRecipe(new ItemStack(Items.Quartz, 8),
  81. " G ",
  82. "GSG",
  83. " G ",
  84. 'G', "blockGlass",
  85. 'S', "blockSand"));
  86. }
  87.  
  88. public static void updateRecipesInCraftingManager() {
  89. RecipeUtils.removeRecipes(gunpowderRecipe, blazeRodRecipe, enderPearlRecipe);
  90.  
  91. gunpowderRecipe.getRecipeOutput().stackSize = GUNPOWDER_AMOUNT;
  92. blazeRodRecipe.getRecipeOutput().stackSize = BLAZE_ROD_AMOUNT;
  93. enderPearlRecipe.getRecipeOutput().stackSize = ENDER_PEARL_AMOUNT;
  94.  
  95. RecipeUtils.addRecipes(gunpowderRecipe, blazeRodRecipe, enderPearlRecipe);
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement