diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
7 files changed, 321 insertions, 112 deletions
diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java new file mode 100644 index 0000000000..213a3f5b7c --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java @@ -0,0 +1,5 @@ +package gtPlusPlus.core.item.bauble; + +public class MonsterKillerBaseBauble { + +} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 02afada849..6360429415 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -2,8 +2,11 @@ package gtPlusPlus.core.item.chemistry; import gregtech.api.enums.TextureSet; import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.material.NONMATERIAL; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -18,9 +21,28 @@ public class GenericChem extends ItemPackage { * Materials */ - public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, "", 0);//Not a GT Inherited Material - public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material - public static final Material TEFLON = new Material("Teflon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{75, 45, 75}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material + public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material + public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material + + //Refined PTFE + public static final Material TEFLON = new Material( + "Teflon", + MaterialState.SOLID, + TextureSet.SET_SHINY, + new short[] { 75, 45, 75 }, + 330, 640, + -1, -1, + false, + null, + 0, + new MaterialStack[] { + new MaterialStack(NONMATERIAL.PTFE, 88), + new MaterialStack(NONMATERIAL.PLASTIC, 6), + new MaterialStack(ELEMENT.getInstance().CHLORINE, 3), + new MaterialStack(ELEMENT.getInstance().SODIUM, 3) + });// Not a GT + // Inherited + // Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java new file mode 100644 index 0000000000..9fd7bf7020 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java @@ -0,0 +1,117 @@ +package gtPlusPlus.core.item.wearable.armour.hazmat; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.item.wearable.armour.ArmourLoader; +import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ArmourHazmat extends BaseArmourHelm { + + public IIcon iconHelm; + + public ArmourHazmat() { + super(ArmourLoader.TinFoilArmour, 0); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister ir) { + this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil"); + } + + @Override + public int getRenderIndex() { + return 0; + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return this.iconHelm; + } + + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return CORE.MODID + ":textures/models/TinFoil.png"; + } + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.rare; + } + + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { + return false; + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + return super.getArmorDisplay(player, armor, slot); + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + + } + + @SuppressWarnings({ "unchecked" }) + @Override + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + aList.add("DoomSquirter's protection against cosmic radiation!"); + aList.add("General paranoia makes the wearer unable to collect xp"); + aList.add("Movement speed is also reduced, to keep you safe"); + aList.add("This hat may also have other strange powers"); + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { + return new ArmorProperties(0, 0, 0); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, + EntityLivingBase p_111207_3_) { + return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_); + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_); + } + + @Override + public boolean onEntityItemUpdate(EntityItem entityItem) { + return super.onEntityItemUpdate(entityItem); + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack != null && player != null && world != null && !world.isRemote) { + if (player instanceof EntityPlayer) { + + } + } + super.onArmorTick(world, player, itemStack); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index f18cd4ec73..8bcbb2a051 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -864,7 +864,7 @@ public final class ALLOY { //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().TITANIUM, 55), - new MaterialStack(ELEMENT.getInstance().PRASEODYMIUM, 12), + new MaterialStack(ELEMENT.getInstance().LANTHANUM, 12), new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 8), new MaterialStack(ELEMENT.getInstance().COBALT, 6), new MaterialStack(ELEMENT.getInstance().MANGANESE, 4), diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 58a7f68afe..8fb3c5fc3b 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -141,7 +141,7 @@ public class Material { this (materialName, defaultState, set, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); } - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ if (mMaterialMap.add(this)) { @@ -442,6 +442,11 @@ public class Material { //Makes a Fancy Chemical Tooltip + + if (chemicalSymbol == null) { + chemicalSymbol = ""; + } + this.vChemicalSymbol = chemicalSymbol; if (this.vMaterialInput != null){ this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java index 4da34ae16c..7ab72d50bc 100644 --- a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java +++ b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java @@ -27,7 +27,11 @@ public class NONMATERIAL { //Wrought Iron public static final Material WROUGHT_IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron); - + //PTFE + public static final Material PTFE = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Polytetrafluoroethylene", "Plastic")); + + //Plastic + public static final Material PLASTIC = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Plastic", "Rubber")); static { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index e6ffe1e89d..c37b1271d7 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -21,159 +21,184 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.Utils; import ic2.core.Ic2Items; import ic2.core.item.armor.ItemArmorHazmat; +import ic2.core.item.armor.ItemArmorNanoSuit; +import ic2.core.item.armor.ItemArmorQuantumSuit; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class HazmatUtils { - - public static final GT_HashSet<GT_ItemStack> sHazmatList = new GT_HashSet<GT_ItemStack>(); - - private static final HashMap<GT_ItemStack, AutoMap<String>> mToolTips = new HashMap<GT_ItemStack, AutoMap<String>>(); - - + public static final GT_HashSet<GT_ItemStack> sHazmatList = new GT_HashSet<GT_ItemStack>(); + + private static final HashMap<String, AutoMap<String>> mToolTips = new HashMap<String, AutoMap<String>>(); + private static boolean mInit = false; private static HazmatUtils mInstance; - + public static void init() { - if (mInit){ + if (mInit) { return; } - + mInstance = new HazmatUtils(); - + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767)); sHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767)); - //Make Nano a hazmat suit - addProtection(Ic2Items.nanoHelmet); - addProtection(Ic2Items.nanoBodyarmor); - addProtection(Ic2Items.nanoLeggings); - addProtection(Ic2Items.nanoBoots); - + // Make Nano a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoBoots:27", 1)); + Logger.INFO("[Hazmat] Registered Nano as hazmat gear."); - - //Make Quantum a hazmat suit - addProtection(Ic2Items.quantumHelmet); - addProtection(Ic2Items.quantumBodyarmor); - addProtection(Ic2Items.quantumLeggings); - addProtection(Ic2Items.quantumBoots); - Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); - - Utils.registerEvent(mInstance); + + // Make Quantum a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumBoots:27", 1)); + Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); + + Utils.registerEvent(mInstance); Logger.INFO("[Hazmat] Registered Tooltip handler for hazmat gear."); mInit = true; - + } - + private final static String mToolTipText = "Provides protection from:"; - + @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event){ - Logger.INFO("Ticking Hazmat handler"); - if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { - Logger.INFO("[Hazmat] Bad Phase : "+GTplusplus.CURRENT_LOAD_PHASE); + public void onItemTooltip(ItemTooltipEvent event) { + //Logger.INFO("Ticking Hazmat handler"); + if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED + && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { + //Logger.INFO("[Hazmat] Bad Phase : " + GTplusplus.CURRENT_LOAD_PHASE); return; } if (event.itemStack == null || isVanillaHazmatPiece(event.itemStack)) { Logger.INFO("[Hazmat] Invalid Itemstack or vanilla hazmat"); return; - } - else { - Logger.INFO("[Hazmat] Finding Tooltip Data"); + } else { ItemStack aStackTemp = event.itemStack; GT_ItemStack aStack = new GT_ItemStack(aStackTemp); - String[] aTooltips = getTooltips(aStack); - if (aTooltips == null || aTooltips.length == 0) { - Logger.INFO("[Hazmat] No Info!"); - return; + if (isNanoArmourPiece(aStackTemp) || isQuantumArmourPiece(aStackTemp)) { + event.toolTip.add("Provides full hazmat protection."); } - else { - Logger.INFO("[Hazmat] Found Tooltips!"); - if (providesProtection(aStackTemp)) { - event.toolTip.add("Provides full hazmat protection."); - } - else { - event.toolTip.add(mToolTipText); - for (String r : aTooltips) { - event.toolTip.add(" - "+r); - } - } - } - } + else { + Logger.INFO("[Hazmat] Finding Tooltip Data"); + String[] aTooltips = getTooltips(aStack); + if (aTooltips == null || aTooltips.length == 0) { + Logger.INFO("[Hazmat] No Info!"); + return; + } else { + Logger.INFO("[Hazmat] Found Tooltips!"); + if (providesProtection(aStackTemp)) { + event.toolTip.add("Provides full hazmat protection."); + } else { + event.toolTip.add(mToolTipText); + for (String r : aTooltips) { + event.toolTip.add(" - " + r); + } + } + } + } + } } - - + /** - * Static function to replace {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. - * Because IC2 doesn't let us register things ourself, anything registered via GT/GT++ will return true. + * Static function to replace + * {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. + * Because IC2 doesn't let us register things ourself, anything registered via + * GT/GT++ will return true. + * * @param living - Entity Wearing Armour * @return - Does {@link EntityLivingBase} have a full hazmat suit on? */ - public static boolean hasCompleteHazmat(EntityLivingBase living) { - //Entity is Null, cannot have Hazmat. + public static boolean hasCompleteHazmat(EntityLivingBase living) { + // Entity is Null, cannot have Hazmat. if (living == null || living.isDead) { return false; - } - else { - - //Map All Player Armour slots + } else { + + // Map All Player Armour slots AutoMap<ItemStack> aEquipment = new AutoMap<ItemStack>(); for (int i = 1; i < 5; ++i) { ItemStack stack = living.getEquipmentInSlot(i); - - //Item is Null, cannot have full suit + + // Item is Null, cannot have full suit if (stack == null) { return false; - } - else { + } else { aEquipment.put(stack); } } - - //Compare Equipment to all items mapped for full hazmat. + + // Compare Equipment to all items mapped for full hazmat. for (ItemStack aSlotStack : aEquipment) { if (!isHazmatPiece(aSlotStack)) { return false; } } - - //We are in some kind of full hazmat, huzzah! - return true; - } + + // We are in some kind of full hazmat, huzzah! + return true; + } } - - + /** * Is this item vanilla IC2 hazmat? + * * @param aArmour - The Armour to provide protection. * @return */ public static boolean isVanillaHazmatPiece(ItemStack aArmour) { - return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; - } + return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; + } + + /** + * Is this item vanilla IC2 Nanosuit? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isNanoArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorNanoSuit : false; + } /** + * Is this item vanilla IC2 Quantum? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isQuantumArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorQuantumSuit : false; + } + + /** * Is this item a registered piece of full hazmat? (Provides all 6 protections) + * * @param aStack - The Armour to provide protection. * @return */ public static boolean isHazmatPiece(ItemStack aStack) { return isVanillaHazmatPiece(aStack) || providesProtection(aStack); } - + /** - * Registers the {@link ItemStack} to all types of protection. - * Provides full hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * Registers the {@link ItemStack} to all types of protection. Provides full + * hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * * @param aStack - The Armour to provide protection. * @return - Did we register this ItemStack properly? */ - public static boolean addProtection(ItemStack aVanStack) { - Logger.INFO("[Hazmat] Registering "+aVanStack.getDisplayName() +" for full Hazmat protection."); + public static boolean addProtection(ItemStack aVanStack) { + Logger.INFO("[Hazmat] Registering " + aVanStack.getDisplayName() + " for full Hazmat protection."); GT_ItemStack aStack = getGtStackFromVanilla(aVanStack); AutoMap<Boolean> aAdded = new AutoMap<Boolean>(); aAdded.put(addProtection_Frost(aStack)); @@ -181,7 +206,7 @@ public class HazmatUtils { aAdded.put(addProtection_Biohazard(aStack)); aAdded.put(addProtection_Gas(aStack)); aAdded.put(addProtection_Radiation(aStack)); - aAdded.put(addProtection_Electricty(aStack)); + aAdded.put(addProtection_Electricty(aStack)); for (boolean b : aAdded) { if (!b) { return false; @@ -189,63 +214,78 @@ public class HazmatUtils { } Logger.INFO("[Hazmat] Protection added for all 6 damage types, registering to master Hazmat list."); sHazmatList.add(aStack); - return true; + return true; } + public static boolean addProtection_Frost(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.AQUA+"Frost"); + registerTooltip(aStack, EnumChatFormatting.AQUA + "Frost"); return addProtection_Generic(sFrostHazmatList, aStack); } + public static boolean addProtection_Fire(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_RED+"Heat"); + registerTooltip(aStack, EnumChatFormatting.DARK_RED + "Heat"); return addProtection_Generic(sHeatHazmatList, aStack); } + public static boolean addProtection_Biohazard(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.GREEN+"Biohazards"); + registerTooltip(aStack, EnumChatFormatting.GREEN + "Biohazards"); return addProtection_Generic(sBioHazmatList, aStack); } + public static boolean addProtection_Gas(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.WHITE+"Gas"); + registerTooltip(aStack, EnumChatFormatting.WHITE + "Gas"); return addProtection_Generic(sGasHazmatList, aStack); } + public static boolean addProtection_Radiation(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_GREEN+"Radiation"); + registerTooltip(aStack, EnumChatFormatting.DARK_GREEN + "Radiation"); return addProtection_Generic(sRadioHazmatList, aStack); } + public static boolean addProtection_Electricty(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.YELLOW+"Electricity"); + registerTooltip(aStack, EnumChatFormatting.YELLOW + "Electricity"); return addProtection_Generic(sElectroHazmatList, aStack); } - + private static boolean addProtection_Generic(GT_HashSet<GT_ItemStack> aSet, GT_ItemStack aStack) { int aMapSize = aSet.size(); aSet.add(aStack); return aMapSize < aSet.size(); } - + /** - * Does this item provide hazmat protection? (Protection against Frost, Heat, Bio, Gas, Rads, Elec) - * An item may return false even if it protects against all six damage types. This is because it's not actually registered as hazmat correct. + * Does this item provide hazmat protection? (Protection against Frost, Heat, + * Bio, Gas, Rads, Elec) An item may return false even if it protects against + * all six damage types. This is because it's not actually registered as hazmat + * correct. + * * @param aStack - The item to check for protection * @return */ public static boolean providesProtection(ItemStack aStack) { return providesProtetion_Generic(sHazmatList, aStack); } + public static boolean providesProtetion_Frost(ItemStack aStack) { return providesProtetion_Generic(sFrostHazmatList, aStack); } + public static boolean providesProtetion_Fire(ItemStack aStack) { return providesProtetion_Generic(sHeatHazmatList, aStack); } + public static boolean providesProtetion_Biohazard(ItemStack aStack) { return providesProtetion_Generic(sBioHazmatList, aStack); } + public static boolean providesProtetion_Gas(ItemStack aStack) { return providesProtetion_Generic(sGasHazmatList, aStack); } + public static boolean providesProtetion_Radiation(ItemStack aStack) { return providesProtetion_Generic(sRadioHazmatList, aStack); } + public static boolean providesProtetion_Electricity(ItemStack aStack) { return providesProtetion_Generic(sElectroHazmatList, aStack); } @@ -256,39 +296,55 @@ public class HazmatUtils { } return aSet.getMap().containsKey(aStack); } - - - private static String[] getTooltips(GT_ItemStack aStack) { - AutoMap<String> aTempTooltipData = mToolTips.get(aStack); + + private static String[] getTooltips(GT_ItemStack aStack) { + String aKey = convertGtItemstackToStringData(aStack); + AutoMap<String> aTempTooltipData = mToolTips.get(aKey); if (aTempTooltipData == null) { - Logger.INFO("[Hazmat] Item was not mapped for TTs"); + Logger.INFO("[Hazmat] Item was not mapped for TTs - "+aKey); return new String[] {}; - } - else { + } else { Logger.INFO("[Hazmat] Item was mapped for TTs"); Collections.sort(aTempTooltipData); Logger.INFO("[Hazmat] Sorted TTs"); return aTempTooltipData.toArray(); } } - + private static void registerTooltip(GT_ItemStack aStack, String aTooltip) { - Logger.INFO("[Hazmat] Mapping "+aTooltip+" for "+getStackFromGtStack(aStack).getDisplayName()); - AutoMap<String> aTempTooltipData = mToolTips.get(aStack); + String aKey = convertGtItemstackToStringData(aStack); + Logger.INFO("[Hazmat] Mapping " + aTooltip + " for " + aKey); + AutoMap<String> aTempTooltipData = mToolTips.get(aKey); if (aTempTooltipData == null) { Logger.INFO("No data mapped yet, creating."); aTempTooltipData = new AutoMap<String>(); } aTempTooltipData.add(aTooltip); - mToolTips.put(aStack, aTempTooltipData); + mToolTips.put(convertGtItemstackToStringData(aStack), aTempTooltipData); } - + public static ItemStack getStackFromGtStack(GT_ItemStack aGtStack) { return ItemUtils.simpleMetaStack(aGtStack.mItem, aGtStack.mMetaData, aGtStack.mStackSize); } - + public static GT_ItemStack getGtStackFromVanilla(ItemStack aStack) { return new GT_ItemStack(aStack); } + + private static String convertGtItemstackToStringData(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mMetaData + "." + aStack.mStackSize; + } + } + private static String convertGtItemstackToStringDataIgnoreDamage(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mStackSize; + } + } + } |