From 208b1f1e0d5faf601b53818b04f6699b2e6cb6bc Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Tue, 5 May 2015 22:07:10 +0100 Subject: - Working on a GUI showing what curses you get with a description on them - Added a search bar in the Liquids Tab for easier searching - Fixed an issue with golden objects giving errors due to missing default texture - Improved the Infamy Mask to have less parts, thus causing less lag - Improved ingots and ore detection - Fixed certain ores when smelted outputting a different ingot - Necklaces and Rings now render as well - Updated the guide at the Guide item to have the proper link to the mod as well as mention the right people who helped with it - Added a list of the ores that work in the guide - Added a new tab to the guide regarding the ores and the ingots they create - Changed the stun effect caused by rings with feathers as modifiers to be a potion effect instead --- .../jewelrycraft/util/JewelrycraftUtil.java | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java') diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index 430673c..4374c70 100644 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -9,6 +9,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.FMLCommonHandler; @@ -25,7 +27,7 @@ public class JewelrycraftUtil public static ArrayList jewelry = new ArrayList(); public static ArrayList metal = new ArrayList(); public static ArrayList ores = new ArrayList(); - public static HashMap oreToIngot = new HashMap(); + public static HashMap oreToIngot = new HashMap(); public static ArrayList jamcraftPlayers = new ArrayList(); private static ArrayList items = new ArrayList(); public static Random rand = new Random(); @@ -135,15 +137,19 @@ public class JewelrycraftUtil Iterator i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator(); while (i.hasNext()){ ItemStack nextStack = i.next(); - if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("powder") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("dust") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("block") && !metal.contains(nextStack)){ + String stackName = nextStack.getItem().getUnlocalizedName().toLowerCase(); + if ((stackName.contains("ingot") || stackName.contains("alloy")) && !metal.contains(nextStack)) metal.add(nextStack); - if (OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")) != null){ - ores.addAll(OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore"))); - Iterator ores = OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")).iterator(); - while (ores.hasNext()){ - ItemStack ore = ores.next(); - oreToIngot.put(ore.getItem(), nextStack); - } + if (nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ore") && !ores.contains(nextStack)){ + ItemStack ingot = FurnaceRecipes.smelting().getSmeltingResult(nextStack); + if(ingot != null && (ingot.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || ingot.getItem().getUnlocalizedName().toLowerCase().contains("alloy"))) + { + ores.add(nextStack); + oreToIngot.put(nextStack, ingot); + JewelrycraftMod.logger.info("Original: " + nextStack); + JewelrycraftMod.logger.info("Adding " + nextStack.getDisplayName() + " with damage value " + nextStack.getItemDamage() + " and with " + nextStack.stackSize + " in stack"); + JewelrycraftMod.logger.info("Original ingot: " + ingot); + JewelrycraftMod.logger.info("Adding ingot " + ingot.getDisplayName() + " with damage value " + ingot.getItemDamage() + " and with " + ingot.stackSize + " in stack\n"); } } } @@ -210,7 +216,7 @@ public class JewelrycraftUtil Iterator i = ores.iterator(); while (i.hasNext()){ ItemStack temp = i.next(); - if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true; + if (temp.getItem().equals(item.getItem()) && temp.getItemDamage() == item.getItemDamage()) return true; } return false; } @@ -221,8 +227,10 @@ public class JewelrycraftUtil * @param ore the ore * @return the ingot */ - public static ItemStack getIngotFromOre(Item ore) + public static ItemStack getIngotFromOre(ItemStack ore) { - return oreToIngot.get(ore); + for(ItemStack ores: JewelrycraftUtil.oreToIngot.keySet()) + if(ores.getItem().equals(ore.getItem()) && ores.getItemDamage() == ore.getItemDamage()) return oreToIngot.get(ores); + return null; } } -- cgit v1.2.3