/* * This file ("InitForeignPaxels.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.items; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.crafting.ToolCrafting; import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.items.tools.ItemAllToolAA; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemTool; import net.minecraftforge.oredict.ShapelessOreRecipe; public class InitForeignPaxels{ public static final String[] MT_NAMES = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"}; private static final String THERMAL_FOUNDATION = "ThermalFoundation"; private static final String MEKANISM_TOOLS = "MekanismTools"; private static final String[] TF_NAMES = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; private static final String[] MT_REPAIR_NAMES = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"}; public static Item[] tfPaxels = new Item[9]; private static Item[] mtPaxels = new Item[6]; public static void init(){ //MekanismTools if(ConfigBoolValues.MT_PAXELS.isEnabled()){ if(Loader.isModLoaded(MEKANISM_TOOLS)){ ModUtil.LOGGER.info("Initializing "+MEKANISM_TOOLS+" AIOTs..."); for(int i = 0; i < mtPaxels.length; i++){ if(!(!ConfigBoolValues.DUPLICATE_PAXELS.isEnabled() && (i == 0 || (i == 3 && ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded(THERMAL_FOUNDATION))))){ Item axe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Axe"); Item pickaxe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Pickaxe"); Item hoe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Hoe"); Item sword = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Sword"); Item shovel = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Shovel"); if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); mtPaxels[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.rare); ItemUtil.register(mtPaxels[i]); if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel)); ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe()); } } } } } else{ ModUtil.LOGGER.info(MEKANISM_TOOLS+" not loaded, can't initialize Special AIOTs."); } } //Thermal Foundation if(ConfigBoolValues.TF_PAXELS.isEnabled()){ if(Loader.isModLoaded(THERMAL_FOUNDATION)){ ModUtil.LOGGER.info("Initializing "+THERMAL_FOUNDATION+" AIOTs..."); for(int i = 0; i < tfPaxels.length; i++){ Item axe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.axe"+TF_NAMES[i]); Item pickaxe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.pickaxe"+TF_NAMES[i]); Item hoe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.hoe"+TF_NAMES[i]); Item sword = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.sword"+TF_NAMES[i]); Item shovel = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.shovel"+TF_NAMES[i]); if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); tfPaxels[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.rare); ItemUtil.register(tfPaxels[i]); if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel)); ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe()); } } } } else{ ModUtil.LOGGER.info(THERMAL_FOUNDATION+" not loaded, can't initialize Special AIOTs."); } } } public static void addToCreativeTab(){ for(Item item : tfPaxels){ if(item != null){ CreativeTab.instance.add(item); } } for(Item item : mtPaxels){ if(item != null){ CreativeTab.instance.add(item); } } } }