mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Added Config Options for Crusher Recipes
This commit is contained in:
parent
6b5516d719
commit
9748d86c0c
5 changed files with 50 additions and 19 deletions
|
@ -13,7 +13,8 @@ public enum ConfigCategories{
|
|||
POTION_RING_CRAFTING("ring crafting"),
|
||||
OTHER("other"),
|
||||
FLUIDS("fluids"),
|
||||
DRILL_VALUES("drill values");
|
||||
DRILL_VALUES("drill values"),
|
||||
CRUSHER_RECIPES("crusher recipes");
|
||||
|
||||
public final String name;
|
||||
|
||||
|
|
|
@ -13,10 +13,12 @@ public class ConfigValues{
|
|||
public static ConfigFloatValues[] floatConfig = ConfigFloatValues.values();
|
||||
public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values();
|
||||
|
||||
public static String[] crusherRecipeExceptions;
|
||||
|
||||
public static void defineConfigValues(Configuration config){
|
||||
|
||||
for(ConfigCrafting currConf : craftingConfig){
|
||||
currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the "+currConf.name+" is Enabled");
|
||||
currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the " + currConf.extraText + "Crafting Recipe for the "+currConf.name+" is Enabled");
|
||||
}
|
||||
for(ConfigIntValues currConf : intConfig){
|
||||
currConf.currentValue = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
|
||||
|
@ -27,5 +29,7 @@ public class ConfigValues{
|
|||
for(ConfigBoolValues currConf : boolConfig){
|
||||
currConf.currentValue = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc);
|
||||
}
|
||||
|
||||
crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered by the Crusher. This list uses OreDictionary Names of the Inputs only.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,11 +107,23 @@ public enum ConfigCrafting{
|
|||
ENERVATOR("Enervator", ConfigCategories.BLOCKS_CRAFTING),
|
||||
|
||||
QUARTZ("Black Quartz in a Crafting Table (as a Backup if there's no Ores to be found anywhere)", ConfigCategories.ITEMS_CRAFTING),
|
||||
LAMPS("Lamps", ConfigCategories.BLOCKS_CRAFTING);
|
||||
LAMPS("Lamps", ConfigCategories.BLOCKS_CRAFTING),
|
||||
|
||||
REDSTONE("Redstone Ore -> Redstone", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
LAPIS("Lapis Ore -> Lapis", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
COAL("Coal -> Coal Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
COAL_BLOCKS("Coal Block -> Coal Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
COBBLESTONE("Cobblestone -> Sand", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
GRAVEL("Gravel -> Flint", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
STONE("Stone -> Cobblestone", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
RICE_SUGAR("Rice -> Sugar", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
NICKEL("Nickel Ore -> Nickel Dust + Platinum Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher"),
|
||||
IRON("Iron Ore -> Iron Dust + Gold Dust", ConfigCategories.CRUSHER_RECIPES, "Crusher");
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
public final boolean defaultValue;
|
||||
public final String extraText;
|
||||
|
||||
public boolean currentValue;
|
||||
|
||||
|
@ -119,10 +131,19 @@ public enum ConfigCrafting{
|
|||
this(name, category, true);
|
||||
}
|
||||
|
||||
ConfigCrafting(String name, ConfigCategories category, boolean defaultValue){
|
||||
ConfigCrafting(String name, ConfigCategories category, String extraText){
|
||||
this(name, category, extraText, true);
|
||||
}
|
||||
|
||||
ConfigCrafting(String name, ConfigCategories category, String extraText, boolean defaultValue){
|
||||
this.name = name;
|
||||
this.category = category.name;
|
||||
this.defaultValue = defaultValue;
|
||||
this.extraText = extraText + " ";
|
||||
}
|
||||
|
||||
ConfigCrafting(String name, ConfigCategories category, boolean defaultValue){
|
||||
this(name, category, "", defaultValue);
|
||||
}
|
||||
|
||||
public boolean isEnabled(){
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ellpeck.actuallyadditions.crafting;
|
||||
|
||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheDusts;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||
|
@ -16,18 +17,18 @@ public class CrusherCrafting{
|
|||
public static void init(){
|
||||
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
|
||||
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal()));
|
||||
if(ConfigCrafting.REDSTONE.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
|
||||
if(ConfigCrafting.LAPIS.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
|
||||
if(ConfigCrafting.COAL.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()));
|
||||
if(ConfigCrafting.COAL_BLOCKS.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal()));
|
||||
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
CrusherRecipeManualRegistry.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
|
||||
if(ConfigCrafting.COBBLESTONE.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand));
|
||||
if(ConfigCrafting.GRAVEL.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
|
||||
if(ConfigCrafting.STONE.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
if(ConfigCrafting.RICE_SUGAR.isEnabled()) CrusherRecipeManualRegistry.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
|
||||
|
||||
CrusherRecipeManualRegistry.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 15, 2, 1);
|
||||
CrusherRecipeManualRegistry.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2, 1);
|
||||
if(ConfigCrafting.NICKEL.isEnabled()) CrusherRecipeManualRegistry.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 15, 2, 1);
|
||||
if(ConfigCrafting.IRON.isEnabled()) CrusherRecipeManualRegistry.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2, 1);
|
||||
|
||||
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("oreNether", 6));
|
||||
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("orePoor", 4, "nugget"));
|
||||
|
@ -36,9 +37,6 @@ public class CrusherCrafting{
|
|||
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("ingot", 1));
|
||||
CrusherRecipeAutoRegistry.searchCases.add(new SearchCase("ore", 2));
|
||||
|
||||
CrusherRecipeAutoRegistry.exceptions.add("ingotBrick");
|
||||
CrusherRecipeAutoRegistry.exceptions.add("ingotBrickNether");
|
||||
|
||||
CrusherRecipeAutoRegistry.registerFinally();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ellpeck.actuallyadditions.recipe;
|
||||
|
||||
import ellpeck.actuallyadditions.config.ConfigValues;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -7,7 +8,6 @@ import java.util.ArrayList;
|
|||
public class CrusherRecipeAutoRegistry{
|
||||
|
||||
public static ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
|
||||
public static ArrayList<String> exceptions = new ArrayList<String>();
|
||||
|
||||
public static class SearchCase{
|
||||
|
||||
|
@ -26,11 +26,18 @@ public class CrusherRecipeAutoRegistry{
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean hasException(String name){
|
||||
for(String except : ConfigValues.crusherRecipeExceptions){
|
||||
if(except.equals(name)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void registerFinally(){
|
||||
String[] names = OreDictionary.getOreNames();
|
||||
for(String inputName : names){
|
||||
|
||||
if(!exceptions.contains(inputName)){
|
||||
if(!hasException(inputName)){
|
||||
int resultAmount = 1;
|
||||
String inputNameWithoutPrefix = null;
|
||||
String replacer = null;
|
||||
|
|
Loading…
Reference in a new issue