From 854fdd1d0dac56100862c07dc1fe3389b230c60b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 12 Jul 2015 22:57:36 +0200 Subject: [PATCH] Added Mekanism Paxels --- .../config/values/ConfigBoolValues.java | 2 + .../items/InitForeignPaxels.java | 75 ++++++++++++++----- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java index 6e289498f..0348ded48 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java @@ -28,6 +28,8 @@ public enum ConfigBoolValues{ DO_CAT_DROPS("Do Cat Drops", ConfigCategories.OTHER, true, "If Cats drop Hairy Balls on Occasion"), TF_PAXELS("Thermal Foundation Paxels", ConfigCategories.OTHER, true, "If Paxels made of Thermal Foundation Materials should exist"), + MT_PAXELS("MekanismTools Paxels", ConfigCategories.OTHER, true, "If Paxels made of MekanismTools Materials should exist"), + DUPLICATE_PAXELS("Allow Duplicate Paxels", ConfigCategories.OTHER, true, "If Paxels are allowed to have Duplicates (for Example ActuallyAdditions' Obsidian and MekanismTools' Obsidian)"), DO_RICE_GEN("Rice Gen", ConfigCategories.WORLD_GEN, true, "If Rice should generate in the World"), DO_CANOLA_GEN("Canola Gen", ConfigCategories.WORLD_GEN, true, "If Canola should generate in the World"), diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index 7410ec502..a8c02c8ed 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -17,36 +17,75 @@ import java.util.List; public class InitForeignPaxels{ - private static Item[] foreignPaxels = new Item[9]; - private static final String[] names = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; + 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 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 void init(){ - if(ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded("ThermalFoundation")){ - ModUtil.LOGGER.info("Initializing Thermal Foundation Material Paxels..."); + //MekanismTools + if(ConfigBoolValues.MT_PAXELS.isEnabled()){ + if(Loader.isModLoaded("MekanismTools")){ + ModUtil.LOGGER.info("Initializing MekanismTools Material Paxels..."); - for(int i = 0; i < foreignPaxels.length; i++){ - Item axe = ItemUtil.getItemFromName("ThermalFoundation:tool.axe"+names[i]); - Item pickaxe = ItemUtil.getItemFromName("ThermalFoundation:tool.pickaxe"+names[i]); - Item hoe = ItemUtil.getItemFromName("ThermalFoundation:tool.hoe"+names[i]); - Item sword = ItemUtil.getItemFromName("ThermalFoundation:tool.sword"+names[i]); - Item shovel = ItemUtil.getItemFromName("ThermalFoundation:tool.shovel"+names[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"))))){ + Item axe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Axe"); + Item pickaxe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Pickaxe"); + Item hoe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Hoe"); + Item sword = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Sword"); + Item shovel = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Shovel"); - if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ - Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); - foreignPaxels[i] = new ItemAllToolAA(material, "ingot"+names[i], "paxel"+names[i], EnumRarity.rare); - ItemUtil.register(foreignPaxels[i]); + 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, mtRepairNames[i], "paxelMT"+mtNames[i], EnumRarity.rare); + ItemUtil.register(mtPaxels[i]); - if(ConfigCrafting.PAXELS.isEnabled()){ - GameRegistry.addRecipe(new ShapelessOreRecipe(foreignPaxels[i], axe, pickaxe, hoe, sword, shovel)); + if(ConfigCrafting.PAXELS.isEnabled()){ + GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel)); + } + } } } } + else ModUtil.LOGGER.info("MekanismTools not loaded, can't initialize special Paxels."); + } + + //Thermal Foundation + if(ConfigBoolValues.TF_PAXELS.isEnabled()){ + if(Loader.isModLoaded("ThermalFoundation")){ + ModUtil.LOGGER.info("Initializing Thermal Foundation Material Paxels..."); + + for(int i = 0; i < tfPaxels.length; i++){ + Item axe = ItemUtil.getItemFromName("ThermalFoundation:tool.axe"+tfNames[i]); + Item pickaxe = ItemUtil.getItemFromName("ThermalFoundation:tool.pickaxe"+tfNames[i]); + Item hoe = ItemUtil.getItemFromName("ThermalFoundation:tool.hoe"+tfNames[i]); + Item sword = ItemUtil.getItemFromName("ThermalFoundation:tool.sword"+tfNames[i]); + Item shovel = ItemUtil.getItemFromName("ThermalFoundation:tool.shovel"+tfNames[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"+tfNames[i], "paxelTF"+tfNames[i], EnumRarity.rare); + ItemUtil.register(tfPaxels[i]); + + if(ConfigCrafting.PAXELS.isEnabled()){ + GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel)); + } + } + } + } + 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 Paxels."); } public static void addToCreativeTab(List list){ - for(Item item : foreignPaxels){ + for(Item item : tfPaxels){ + if(item != null){ + item.getSubItems(item, CreativeTab.instance, list); + } + } + for(Item item : mtPaxels){ if(item != null){ item.getSubItems(item, CreativeTab.instance, list); }