2015-11-14 21:27:36 +01:00
|
|
|
/*
|
2015-12-03 22:49:31 +01:00
|
|
|
* This file ("LensNoneRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
|
2015-11-14 21:27:36 +01:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
|
|
|
* © 2015 Ellpeck
|
|
|
|
*/
|
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
package ellpeck.actuallyadditions.items.lens;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
2015-11-20 22:25:04 +01:00
|
|
|
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
2015-12-01 23:23:55 +01:00
|
|
|
import ellpeck.actuallyadditions.items.InitItems;
|
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheCrystals;
|
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
|
|
|
import ellpeck.actuallyadditions.util.ItemUtil;
|
2015-11-22 18:52:11 +01:00
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
2015-12-01 23:23:55 +01:00
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.init.Items;
|
2015-11-14 23:05:20 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2015-12-01 23:23:55 +01:00
|
|
|
import java.util.Collections;
|
2015-11-15 18:14:39 +01:00
|
|
|
import java.util.List;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
public class LensNoneRecipeHandler{
|
2015-11-14 21:27:36 +01:00
|
|
|
|
|
|
|
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
2015-11-25 22:13:51 +01:00
|
|
|
|
|
|
|
public static ArrayList<Recipe> mainPageRecipes = new ArrayList<Recipe>();
|
|
|
|
public static Recipe recipeColorLens;
|
|
|
|
public static Recipe recipeSoulSand;
|
|
|
|
public static Recipe recipeGreenWall;
|
|
|
|
public static Recipe recipeWhiteWall;
|
2015-11-27 15:57:38 +01:00
|
|
|
public static Recipe recipeExplosionLens;
|
2015-11-28 19:30:24 +01:00
|
|
|
public static Recipe recipeDamageLens;
|
2015-11-29 00:31:04 +01:00
|
|
|
public static Recipe recipeLeather;
|
2015-12-17 17:07:49 +01:00
|
|
|
public static Recipe[] recipesGlowstoneRedstone = new Recipe[2];
|
2015-11-14 21:27:36 +01:00
|
|
|
|
|
|
|
public static void init(){
|
2015-11-22 21:00:05 +01:00
|
|
|
//Crystal Blocks
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.redstone_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.REDSTONE.ordinal()), 400);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.lapis_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.LAPIS.ordinal()), 400);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.diamond_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.DIAMOND.ordinal()), 600);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.emerald_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.EMERALD.ordinal()), 1000);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.COAL.ordinal()), 600);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.iron_block), new ItemStack(InitBlocks.blockCrystal, 1, TheCrystals.IRON.ordinal()), 800);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-11-20 22:25:04 +01:00
|
|
|
|
2015-11-22 21:00:05 +01:00
|
|
|
//Crystal Items
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.redstone), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), 40);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.dye, 1, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), 40);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.diamond), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), 60);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.emerald), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), 100);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), 60);
|
2015-11-25 22:13:51 +01:00
|
|
|
mainPageRecipes.add(Util.GetRecipes.lastReconstructorRecipe());
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.iron_ingot), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), 80);
|
2015-11-20 22:25:04 +01:00
|
|
|
|
2015-11-22 21:00:05 +01:00
|
|
|
//Lenses
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), new ItemStack(InitItems.itemColorLens), 5000);
|
2015-11-25 22:13:51 +01:00
|
|
|
recipeColorLens = Util.GetRecipes.lastReconstructorRecipe();
|
2015-11-28 19:36:44 +01:00
|
|
|
|
|
|
|
if(ConfigCrafting.RECONSTRUCTOR_EXPLOSION_LENS.isEnabled()){
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemExplosionLens), 5000);
|
2015-11-28 19:36:44 +01:00
|
|
|
recipeExplosionLens = Util.GetRecipes.lastReconstructorRecipe();
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(InitItems.itemExplosionLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
2015-11-28 19:36:44 +01:00
|
|
|
}
|
|
|
|
else{
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(InitItems.itemColorLens), new ItemStack(InitItems.itemDamageLens), 5000);
|
2015-11-28 19:36:44 +01:00
|
|
|
}
|
2015-11-28 19:30:24 +01:00
|
|
|
recipeDamageLens = Util.GetRecipes.lastReconstructorRecipe();
|
2015-11-28 19:36:44 +01:00
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(InitItems.itemDamageLens), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.LENS.ordinal()), 5000);
|
2015-11-22 21:00:05 +01:00
|
|
|
|
|
|
|
//Misc
|
2015-11-20 22:25:04 +01:00
|
|
|
if(ConfigCrafting.RECONSTRUCTOR_MISC.isEnabled()){
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.sand), new ItemStack(Blocks.soul_sand), 20000);
|
2015-11-25 22:13:51 +01:00
|
|
|
recipeSoulSand = Util.GetRecipes.lastReconstructorRecipe();
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Items.rotten_flesh), new ItemStack(Items.leather), 8000);
|
2015-11-29 00:31:04 +01:00
|
|
|
recipeLeather = Util.GetRecipes.lastReconstructorRecipe();
|
2015-12-01 23:23:55 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.quartz_block), new ItemStack(InitBlocks.blockTestifiBucksWhiteWall), 10);
|
2015-11-25 22:13:51 +01:00
|
|
|
recipeWhiteWall = Util.GetRecipes.lastReconstructorRecipe();
|
2015-12-03 22:49:31 +01:00
|
|
|
addRecipe(new ItemStack(Blocks.quartz_block, 1, 1), new ItemStack(InitBlocks.blockTestifiBucksGreenWall), 10);
|
2015-11-25 22:13:51 +01:00
|
|
|
recipeGreenWall = Util.GetRecipes.lastReconstructorRecipe();
|
2015-12-17 17:07:49 +01:00
|
|
|
|
|
|
|
addRecipe(new ItemStack(Items.redstone), new ItemStack(Items.glowstone_dust), 4000);
|
|
|
|
recipesGlowstoneRedstone[0] = Util.GetRecipes.lastReconstructorRecipe();
|
|
|
|
addRecipe(new ItemStack(Items.glowstone_dust), new ItemStack(Items.redstone), 4000);
|
|
|
|
recipesGlowstoneRedstone[1] = Util.GetRecipes.lastReconstructorRecipe();
|
2015-11-20 22:25:04 +01:00
|
|
|
}
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
public static void addRecipe(ItemStack input, ItemStack output, int energyUse){
|
2015-12-03 22:49:31 +01:00
|
|
|
recipes.add(new Recipe(input, output, energyUse));
|
2015-12-01 23:23:55 +01:00
|
|
|
}
|
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
public static void addRecipe(String input, String output, int energyUse){
|
|
|
|
recipes.add(new Recipe(input, output, energyUse));
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
public static ArrayList<Recipe> getRecipesFor(ItemStack input){
|
2015-11-22 20:23:54 +01:00
|
|
|
ArrayList<Recipe> possibleRecipes = new ArrayList<Recipe>();
|
2015-11-14 21:27:36 +01:00
|
|
|
for(Recipe recipe : recipes){
|
2015-12-01 23:23:55 +01:00
|
|
|
if(ItemUtil.contains(recipe.getInputs(), input, true)){
|
|
|
|
possibleRecipes.add(recipe);
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
}
|
2015-11-22 20:23:54 +01:00
|
|
|
return possibleRecipes;
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-12-01 19:48:09 +01:00
|
|
|
public static class Recipe{
|
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
private String input;
|
|
|
|
private String output;
|
2015-12-01 19:48:09 +01:00
|
|
|
public int energyUse;
|
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
private ItemStack inputStack;
|
|
|
|
private ItemStack outputStack;
|
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
public Recipe(ItemStack input, ItemStack output, int energyUse){
|
2015-12-01 23:23:55 +01:00
|
|
|
this.inputStack = input;
|
|
|
|
this.outputStack = output;
|
|
|
|
this.energyUse = energyUse;
|
|
|
|
}
|
|
|
|
|
2015-12-03 22:49:31 +01:00
|
|
|
public Recipe(String input, String output, int energyUse){
|
2015-12-01 19:48:09 +01:00
|
|
|
this.input = input;
|
|
|
|
this.output = output;
|
|
|
|
this.energyUse = energyUse;
|
|
|
|
}
|
|
|
|
|
2015-12-01 23:23:55 +01:00
|
|
|
public List<ItemStack> getOutputs(){
|
|
|
|
if(this.outputStack != null){
|
|
|
|
return Collections.singletonList(this.outputStack.copy());
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.output == null || this.output.isEmpty()){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-12-01 19:48:09 +01:00
|
|
|
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
|
2015-12-01 23:23:55 +01:00
|
|
|
for(ItemStack stack : stacks){
|
|
|
|
stack.stackSize = 1;
|
|
|
|
}
|
|
|
|
return stacks;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<ItemStack> getInputs(){
|
|
|
|
if(this.inputStack != null){
|
|
|
|
return Collections.singletonList(this.inputStack.copy());
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.input == null || this.input.isEmpty()){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
|
|
|
for(ItemStack stack : stacks){
|
2015-12-01 19:48:09 +01:00
|
|
|
stack.stackSize = 1;
|
|
|
|
}
|
2015-12-01 23:23:55 +01:00
|
|
|
return stacks;
|
2015-12-01 19:48:09 +01:00
|
|
|
}
|
2015-11-22 18:52:11 +01:00
|
|
|
}
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|