2015-11-14 21:27:36 +01:00
|
|
|
/*
|
|
|
|
* This file ("AtomicReconstructorRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
package ellpeck.actuallyadditions.recipe;
|
|
|
|
|
2015-11-20 22:25:04 +01:00
|
|
|
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
2015-11-22 18:52:11 +01:00
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
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-11-15 18:14:39 +01:00
|
|
|
import java.util.List;
|
2015-11-14 23:05:20 +01:00
|
|
|
import java.util.Objects;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
2015-11-15 18:05:58 +01:00
|
|
|
public class ReconstructorRecipeHandler{
|
2015-11-14 21:27:36 +01:00
|
|
|
|
|
|
|
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
2015-11-20 22:25:04 +01:00
|
|
|
public static final int RECIPES_FOR_BOOKLET_PAGE = 12;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
|
|
|
public static void init(){
|
2015-11-20 22:25:04 +01:00
|
|
|
addRecipe("blockRedstone", "blockCrystalRed", 400);
|
|
|
|
addRecipe("blockLapis", "blockCrystalBlue", 400);
|
|
|
|
addRecipe("blockDiamond", "blockCrystalLightBlue", 6000);
|
|
|
|
addRecipe("blockEmerald", "blockCrystalGreen", 10000);
|
|
|
|
addRecipe("blockCoal", "blockCrystalBlack", 600);
|
|
|
|
addRecipe("blockIron", "blockCrystalWhite", 800);
|
|
|
|
|
|
|
|
addRecipe("dustRedstone", "crystalRed", 40);
|
|
|
|
addRecipe("gemLapis", "crystalBlue", 40);
|
|
|
|
addRecipe("gemDiamond", "crystalLightBlue", 600);
|
|
|
|
addRecipe("gemEmerald", "crystalGreen", 1000);
|
|
|
|
addRecipe("coal", "crystalBlack", 60);
|
|
|
|
addRecipe("ingotIron", "crystalWhite", 80);
|
|
|
|
|
|
|
|
if(ConfigCrafting.RECONSTRUCTOR_MISC.isEnabled()){
|
|
|
|
addRecipe("sand", "soulSand", 20000);
|
|
|
|
addRecipe("blockQuartz", "blockWhiteBrick", 10);
|
|
|
|
}
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-11-20 21:21:21 +01:00
|
|
|
public static void addRecipe(String input, String output, int energyUse){
|
2015-11-22 18:52:11 +01:00
|
|
|
addRecipe(input, output, energyUse, LensType.NONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void addRecipe(String input, String output, int energyUse, LensType type){
|
|
|
|
recipes.add(new Recipe(input, output, energyUse, type));
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-11-14 23:05:20 +01:00
|
|
|
public static Recipe getRecipe(ItemStack input){
|
2015-11-14 21:27:36 +01:00
|
|
|
for(Recipe recipe : recipes){
|
2015-11-14 23:05:20 +01:00
|
|
|
int[] ids = OreDictionary.getOreIDs(input);
|
|
|
|
for(int id : ids){
|
|
|
|
if(Objects.equals(OreDictionary.getOreName(id), recipe.input)){
|
|
|
|
return recipe;
|
|
|
|
}
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class Recipe{
|
|
|
|
|
2015-11-14 23:05:20 +01:00
|
|
|
public String input;
|
|
|
|
public String output;
|
2015-11-20 21:21:21 +01:00
|
|
|
public int energyUse;
|
2015-11-22 18:52:11 +01:00
|
|
|
public LensType type;
|
2015-11-14 21:27:36 +01:00
|
|
|
|
2015-11-22 18:52:11 +01:00
|
|
|
public Recipe(String input, String output, int energyUse, LensType type){
|
2015-11-14 21:27:36 +01:00
|
|
|
this.input = input;
|
|
|
|
this.output = output;
|
2015-11-20 21:21:21 +01:00
|
|
|
this.energyUse = energyUse;
|
2015-11-22 18:52:11 +01:00
|
|
|
this.type = type;
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-11-14 23:05:20 +01:00
|
|
|
public ItemStack getFirstOutput(){
|
2015-11-15 18:14:39 +01:00
|
|
|
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
|
2015-11-14 23:05:20 +01:00
|
|
|
if(stacks != null && !stacks.isEmpty()){
|
|
|
|
return stacks.get(0);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|
|
|
|
|
2015-11-22 18:52:11 +01:00
|
|
|
public enum LensType{
|
|
|
|
|
|
|
|
NONE,
|
|
|
|
COLOR;
|
|
|
|
|
|
|
|
public float getR(){
|
|
|
|
if(this == COLOR){
|
|
|
|
return Util.RANDOM.nextFloat();
|
|
|
|
}
|
|
|
|
return 27F/255F;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getG(){
|
|
|
|
if(this == COLOR){
|
|
|
|
return Util.RANDOM.nextFloat();
|
|
|
|
}
|
|
|
|
return 109F/255F;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getB(){
|
|
|
|
if(this == COLOR){
|
|
|
|
return Util.RANDOM.nextFloat();
|
|
|
|
}
|
|
|
|
return 1F;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-14 21:27:36 +01:00
|
|
|
}
|