diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-17 17:20:23 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-17 17:20:23 +1000 |
commit | 289e41515842ec89d01bfa593504163f75d0950c (patch) | |
tree | 3601b0b44d202e2a6960a5ff011bc747c4281c39 /src/Java | |
parent | dd97ed90a0eb4ab47ef445c259e63f70d5c008d6 (diff) | |
download | GT5-Unofficial-289e41515842ec89d01bfa593504163f75d0950c.tar.gz GT5-Unofficial-289e41515842ec89d01bfa593504163f75d0950c.tar.bz2 GT5-Unofficial-289e41515842ec89d01bfa593504163f75d0950c.zip |
% Improved Multitool Generation.
Diffstat (limited to 'src/Java')
5 files changed, 92 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java new file mode 100644 index 0000000000..ca67ea1b54 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java @@ -0,0 +1,73 @@ +package gtPlusPlus.core.item.init; + +import gregtech.api.enums.Materials; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; + +public class ItemsMultiTools { + + public static void load(){ + run(); + } + + private static void run(){ + + //Load Multitools + boolean gtStyleTools = LoadedMods.Gregtech; + if (CORE.configSwitches.enableMultiSizeTools){ + + //GT Materials + Materials[] rm = Materials.values(); + for (Materials m : rm){ + toolFactoryGT(m, gtStyleTools); + } + + //GT++ Materials + toolFactory(ALLOY.HASTELLOY_C276); + toolFactory(ALLOY.HASTELLOY_N); + toolFactory(ALLOY.HASTELLOY_W); + toolFactory(ALLOY.HASTELLOY_X); + toolFactory(ALLOY.INCOLOY_020); + toolFactory(ALLOY.INCOLOY_DS); + toolFactory(ALLOY.INCOLOY_MA956); + toolFactory(ALLOY.INCONEL_625); + toolFactory(ALLOY.INCONEL_690); + toolFactory(ALLOY.INCONEL_792); + toolFactory(ALLOY.LEAGRISIUM); + toolFactory(ALLOY.TANTALLOY_60); + toolFactory(ALLOY.TANTALLOY_61); + toolFactory(ALLOY.STABALLOY); + toolFactory(ALLOY.QUANTUM); + toolFactory(ALLOY.BEDROCKIUM); + toolFactory(ALLOY.POTIN); + toolFactory(ALLOY.TUMBAGA); + toolFactory(ALLOY.TALONITE); + toolFactory(ALLOY.STELLITE); + toolFactory(ALLOY.TUNGSTEN_CARBIDE); + toolFactory(ALLOY.TANTALUM_CARBIDE); + + + } + + } + + + private static boolean toolFactoryGT(Materials m, boolean b){ + ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(b, m); + ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(b, m); + return true; + } + + private static boolean toolFactory(Material m){ + Utils.LOG_WARNING("Generating Multi-Tools for "+m.getLocalizedName()); + ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(m); + ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(m); + return true; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 5c5ca9fa0b..e278c258ba 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -71,19 +71,25 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ */ private boolean addRecipe(){ - String plateDense = "plateDense"+materialName; - String plateDouble = "plateDouble"+materialName; - String rodLong = "stickLong"+materialName; + + String cleanName = Utils.sanitizeString(materialName); + + String plateDense = "plateDense"+cleanName; + String plateDouble = "plateDouble"+cleanName; + String rodLong = "stickLong"+cleanName; String toolHammer = "craftingToolHardHammer"; String toolWrench = "craftingToolWrench"; String toolFile = "craftingToolFile"; String toolScrewDriver = "craftingToolScrewdriver"; - + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ + Utils.LOG_WARNING("stickLong of "+cleanName+" does not exist."); return false; } if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ + Utils.LOG_WARNING("plateDense of "+cleanName+" does not exist."); if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){ + Utils.LOG_WARNING("plateDouble of "+cleanName+" does exist. Using it instead."); RecipeUtils.recipeBuilder( plateDouble, plateDouble, plateDouble, toolFile, rodLong, toolHammer, @@ -92,6 +98,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ return true; } + Utils.LOG_WARNING("plateDouble of "+cleanName+" does not exist."); return false; } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java index 08db58500a..bfe78b1866 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java @@ -58,9 +58,10 @@ public class MultiSpadeBase extends StaballoySpade{ } private boolean addRecipe(){ - String plateDense = "plateDense"+materialName; - String plateDouble = "plateDouble"+materialName; - String rodLong = "stickLong"+materialName; + String cleanName = Utils.sanitizeString(materialName); + String plateDense = "plateDense"+cleanName; + String plateDouble = "plateDouble"+cleanName; + String rodLong = "stickLong"+cleanName; String toolHammer = "craftingToolHardHammer"; String toolWrench = "craftingToolWrench"; String toolFile = "craftingToolFile"; diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index c9041f8906..10a8f0fa3e 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -547,6 +547,7 @@ public class Utils { float damage = material.vToolQuality; int efficiency = (int) material.vToolQuality; //int enchantability = material.mEnchantmentToolsLevel; + Utils.LOG_INFO("ToolMaterial stats for "+material.getLocalizedName()+" | harvestLevel:"+harvestLevel+" | durability:"+durability+" | toolQuality:"+damage+" | toolSpeed:"+damage); ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 81357e66c8..140d3511a1 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -313,7 +313,7 @@ public class ItemUtils { } public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba){ - Utils.LOG_WARNING("Generating a Multi-Pick out of "+name); + Utils.LOG_INFO("Generating a Multi-Pick out of "+name); short[] rgb = rgba; int dur = customMaterial.getMaxUses(); Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); @@ -338,7 +338,8 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; - } + } + Utils.LOG_INFO("Pickaxe was not valid."); return null; } |