Added a Config Option for Mashed Food Crafting Blacklisting

This commit is contained in:
Ellpeck 2015-07-13 03:28:04 +02:00
parent 838de26650
commit 8d52dbbb94
3 changed files with 31 additions and 20 deletions

View file

@ -14,6 +14,7 @@ public class ConfigValues{
public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values();
public static String[] crusherRecipeExceptions; public static String[] crusherRecipeExceptions;
public static String[] mashedFoodCraftingExceptions;
public static void defineConfigValues(Configuration config){ public static void defineConfigValues(Configuration config){
@ -31,5 +32,6 @@ public class ConfigValues{
} }
crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."); crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only.");
mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can't be used to craft Mashed Food. These are the actual Item Names, the ones you use, for example, when using the /give Command. Always ModName:ItemName, for example 'Minecraft:stone' or 'ActuallyAdditions:itemHoeObsidian'.");
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.*; import ellpeck.actuallyadditions.items.metalists.*;
@ -18,6 +19,8 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.Arrays;
public class ItemCrafting{ public class ItemCrafting{
public static void init(){ public static void init(){
@ -280,10 +283,12 @@ public class ItemCrafting{
if(ConfigCrafting.MASHED_FOOD.isEnabled()){ if(ConfigCrafting.MASHED_FOOD.isEnabled()){
for(Object nextIterator : Item.itemRegistry){ for(Object nextIterator : Item.itemRegistry){
if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){ if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){
if(!Arrays.asList(ConfigValues.mashedFoodCraftingExceptions).contains(Item.itemRegistry.getNameForObject(nextIterator))){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
} }
} }
} }
} }
}
} }

View file

@ -17,25 +17,29 @@ import java.util.List;
public class InitForeignPaxels{ public class InitForeignPaxels{
private static final String THERMAL_FOUNDATION = "ThermalFoundation";
private static final String MEKANISM_TOOLS = "MekanismTools";
public static Item[] tfPaxels = new Item[9]; public static Item[] tfPaxels = new Item[9];
private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"};
private static Item[] mtPaxels = new Item[6]; private static Item[] mtPaxels = new Item[6];
private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"};
public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"}; public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"};
private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"};
public static void init(){ public static void init(){
//MekanismTools //MekanismTools
if(ConfigBoolValues.MT_PAXELS.isEnabled()){ if(ConfigBoolValues.MT_PAXELS.isEnabled()){
if(Loader.isModLoaded("MekanismTools")){ if(Loader.isModLoaded(MEKANISM_TOOLS)){
ModUtil.LOGGER.info("Initializing MekanismTools Material Paxels..."); ModUtil.LOGGER.info("Initializing "+MEKANISM_TOOLS+" AIOTs...");
for(int i = 0; i < mtPaxels.length; i++){ for(int i = 0; i < mtPaxels.length; i++){
if(!(!ConfigBoolValues.DUPLICATE_PAXELS.isEnabled() && (i == 0 || (i == 3 && ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded("ThermalFoundation"))))){ if(!(!ConfigBoolValues.DUPLICATE_PAXELS.isEnabled() && (i == 0 || (i == 3 && ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded(THERMAL_FOUNDATION))))){
Item axe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Axe"); Item axe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Axe");
Item pickaxe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Pickaxe"); Item pickaxe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Pickaxe");
Item hoe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Hoe"); Item hoe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Hoe");
Item sword = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Sword"); Item sword = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Sword");
Item shovel = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Shovel"); Item shovel = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Shovel");
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); Item.ToolMaterial material = ((ItemTool)axe).func_150913_i();
@ -49,20 +53,20 @@ public class InitForeignPaxels{
} }
} }
} }
else ModUtil.LOGGER.info("MekanismTools not loaded, can't initialize special Paxels."); else ModUtil.LOGGER.info(MEKANISM_TOOLS+" not loaded, can't initialize Special AIOTs.");
} }
//Thermal Foundation //Thermal Foundation
if(ConfigBoolValues.TF_PAXELS.isEnabled()){ if(ConfigBoolValues.TF_PAXELS.isEnabled()){
if(Loader.isModLoaded("ThermalFoundation")){ if(Loader.isModLoaded(THERMAL_FOUNDATION)){
ModUtil.LOGGER.info("Initializing Thermal Foundation Material Paxels..."); ModUtil.LOGGER.info("Initializing "+THERMAL_FOUNDATION+" AIOTs...");
for(int i = 0; i < tfPaxels.length; i++){ for(int i = 0; i < tfPaxels.length; i++){
Item axe = ItemUtil.getItemFromName("ThermalFoundation:tool.axe"+tfNames[i]); Item axe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.axe"+tfNames[i]);
Item pickaxe = ItemUtil.getItemFromName("ThermalFoundation:tool.pickaxe"+tfNames[i]); Item pickaxe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.pickaxe"+tfNames[i]);
Item hoe = ItemUtil.getItemFromName("ThermalFoundation:tool.hoe"+tfNames[i]); Item hoe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.hoe"+tfNames[i]);
Item sword = ItemUtil.getItemFromName("ThermalFoundation:tool.sword"+tfNames[i]); Item sword = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.sword"+tfNames[i]);
Item shovel = ItemUtil.getItemFromName("ThermalFoundation:tool.shovel"+tfNames[i]); Item shovel = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.shovel"+tfNames[i]);
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); Item.ToolMaterial material = ((ItemTool)axe).func_150913_i();
@ -75,7 +79,7 @@ public class InitForeignPaxels{
} }
} }
} }
else ModUtil.LOGGER.info("Thermal Foundation not loaded, can't initialize special Paxels."); else ModUtil.LOGGER.info(THERMAL_FOUNDATION+" not loaded, can't initialize Special AIOTs.");
} }
} }