diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-14 15:42:43 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-14 15:42:43 +1000 |
commit | 881eece559ff4eb2646973de1717d795c16c543b (patch) | |
tree | 4cce79b3d1bc8ee6dc65f49741cb7663db64e945 /src/Java/gtPlusPlus/core/util/item | |
parent | c8612eb547b97653489e23108a1cbb6fb3a21f3c (diff) | |
download | GT5-Unofficial-881eece559ff4eb2646973de1717d795c16c543b.tar.gz GT5-Unofficial-881eece559ff4eb2646973de1717d795c16c543b.tar.bz2 GT5-Unofficial-881eece559ff4eb2646973de1717d795c16c543b.zip |
$ Re-wrote the handling of Multitool generation, to allow my own materials to have tools.
% Bumped Multispade durability by 3x.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/item')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/item/ItemUtils.java | 110 |
1 files changed, 68 insertions, 42 deletions
diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 2ce6d5bb66..409e52a579 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -253,11 +253,11 @@ public class ItemUtils { public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){ if (CORE.DEBUG){ - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); } ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ @@ -283,48 +283,54 @@ public class ItemUtils { new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; return output; } - + public static Item[] generateSpecialUseDusts(Material material, boolean onlyLargeDust){ String materialName = material.getLocalizedName(); String unlocalizedName = Utils.sanitizeString(materialName); int Colour = material.getRgbAsHex(); Item[] output = null; if (onlyLargeDust == false){ - output = new Item[]{ - new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), - new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; + output = new Item[]{ + new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), + new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), + new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; } else{ output = new Item[]{ - new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust") - }; + new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust") + }; } return output; } public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); - Utils.LOG_WARNING("Generating a Multi-Pick out of "+material.name()); - short[] rgb; - rgb = material.getRGBA(); - int dur = customMaterial.getMaxUses()*3; - Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur); + ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + return generateMultiPick(GT_Durability, customMaterial, material.name(), material.mDurability, material.mRGBa); + } + + public static MultiPickaxeBase generateMultiPick(Material material){ + ToolMaterial customMaterial = Utils.generateToolMaterial(material); + return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA()); + } + + 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); + short[] rgb = rgba; + int dur = customMaterial.getMaxUses(); + Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ - dur = material.mDurability*100; - Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+"."); + dur = durability*100; + Utils.LOG_WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); } else if (dur <= 0){ - dur = material.mDurability; - Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); + dur = durability; + Utils.LOG_WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); } - if (dur <= 0){ - Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused."); + Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); return null; } - MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( - material.name()+" Multipick", + name+" Multipick", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) @@ -334,32 +340,42 @@ public class ItemUtils { return MP_Redstone; } return null; - } - + + + + + + public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); - Utils.LOG_WARNING("Generating a Multi-Shovel out of "+material.name()); - short[] rgb; - rgb = material.getRGBA(); + ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + return generateMultiShovel(GT_Durability, customMaterial, material.name(), material.mDurability, material.mRGBa); + } + + public static MultiSpadeBase generateMultiShovel(Material material){ + ToolMaterial customMaterial = Utils.generateToolMaterial(material); + return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA()); + } + + public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba){ + Utils.LOG_WARNING("Generating a Multi-Spade out of "+name); + short[] rgb = rgba; int dur = customMaterial.getMaxUses(); - Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur); + Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ - dur = material.mDurability*100; - Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+"."); + dur = durability*100; + Utils.LOG_WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); } else if (dur <= 0){ - dur = material.mDurability; - Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); + dur = durability; + Utils.LOG_WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); } - if (dur <= 0){ - Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused."); + Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); return null; } - MultiSpadeBase MP_Redstone = new MultiSpadeBase( - material.name()+" Multishovel", + name+" Multispade", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) @@ -369,9 +385,19 @@ public class ItemUtils { return MP_Redstone; } return null; - } + + + + + + + + + + + public static BaseItemDecidust generateDecidust(Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); |