ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/CrusherCrafting.java

145 lines
9.5 KiB
Java
Raw Normal View History

2016-01-05 04:47:35 +01:00
/*
2016-05-16 22:52:27 +02:00
* This file ("CrusherCrafting.java") is part of the Actually Additions mod for Minecraft.
2016-01-05 04:47:35 +01:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2016-01-05 04:47:35 +01:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2017-01-01 16:23:26 +01:00
* © 2015-2017 Ellpeck
2016-01-05 04:47:35 +01:00
*/
package de.ellpeck.actuallyadditions.mod.crafting;
import java.util.ArrayList;
2018-06-29 22:32:33 +02:00
import java.util.List;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
2018-05-10 11:38:58 +02:00
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
2016-03-18 18:41:37 +01:00
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
2017-08-23 02:01:54 +02:00
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
2016-01-05 04:47:35 +01:00
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
2017-08-23 02:01:54 +02:00
import net.minecraft.util.NonNullList;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient;
2016-01-05 04:47:35 +01:00
2018-06-29 22:32:33 +02:00
public final class CrusherCrafting {
2016-01-05 04:47:35 +01:00
public static final ArrayList<CrusherRecipe> MISC_RECIPES = new ArrayList<>();
2016-01-05 04:47:35 +01:00
public static CrusherRecipe recipeIronHorseArmor;
public static CrusherRecipe recipeGoldHorseArmor;
public static CrusherRecipe recipeDiamondHorseArmor;
2018-06-29 22:32:33 +02:00
public static void init() {
2018-05-10 11:38:58 +02:00
ActuallyAdditions.LOGGER.info("Initializing Crusher Recipes...");
2018-06-29 22:32:33 +02:00
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getEmpty(), 0);
2017-03-30 18:14:18 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2016-01-05 04:47:35 +01:00
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2016-01-05 04:47:35 +01:00
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreRedstone"))
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreRedstone"), new ItemStack(Items.REDSTONE, 10), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreLapis"))
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreLapis"), new ItemStack(Items.DYE, 12, 4), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("coal"))
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("coal"), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreCoal"))
2018-06-29 22:32:33 +02:00
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreCoal"), new ItemStack(Items.COAL, 3), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("blockCoal"))
2018-06-29 22:32:33 +02:00
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("blockCoal"), new ItemStack(Items.COAL, 9), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreQuartz"))
2018-06-29 22:32:33 +02:00
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("oreQuartz"), new ItemStack(Items.QUARTZ, 3), StackUtil.getEmpty(), 0);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("cobblestone"))
ActuallyAdditionsAPI.addCrusherRecipe(new OreIngredient("cobblestone"), new ItemStack(Blocks.SAND), StackUtil.getEmpty(), 0);
2016-04-20 21:39:03 +02:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("stone"))
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, NonNullList.withSize(1, StackUtil.getEmpty()), 0, 0);
2016-01-05 04:47:35 +01:00
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2016-01-05 04:47:35 +01:00
2017-11-02 22:49:53 +01:00
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getEmpty(), 0);
2016-06-17 23:50:38 +02:00
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
2016-01-05 04:47:35 +01:00
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreNickel"))
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15);
2018-09-26 10:02:42 +02:00
if(!CrusherRecipeRegistry.hasException("oreIron"))
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20);
2016-01-05 04:47:35 +01:00
2018-06-29 22:32:33 +02:00
ItemStack temp = getStack("dustIron");
if (!temp.isEmpty()) {
temp.setCount(6);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.IRON_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe();
}
temp = getStack("dustGold");
if (!temp.isEmpty()) {
temp.setCount(6);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.GOLDEN_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe();
}
temp = getStack("dustDiamond");
if (!temp.isEmpty()) {
temp.setCount(6);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.DIAMOND_HORSE_ARMOR), temp, StackUtil.getEmpty(), 0);
recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe();
}
2016-01-05 04:47:35 +01:00
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("orePoor", 4, "nugget"));
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("denseore", 8));
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("gem", 1));
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ingot", 1));
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2, "gem")); //Search for gems first so removeDuplicates doesn't clear gem recipes.
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("ore", 2));
2016-01-05 04:47:35 +01:00
CrusherRecipeRegistry.registerFinally();
}
2018-06-29 22:32:33 +02:00
private static ItemStack getStack(String ore) {
List<ItemStack> stacks = OreDictionary.getOres(ore);
if (stacks.isEmpty()) return StackUtil.getEmpty();
return stacks.get(0).copy();
}
2016-01-05 04:47:35 +01:00
}