summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-05-05 22:07:10 +0100
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-05-05 22:07:10 +0100
commit208b1f1e0d5faf601b53818b04f6699b2e6cb6bc (patch)
tree56c059b812f1917b582e65e7ef15faa70a429f0b /src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
parent80417b99e10a462fd72b8f8fcd3b226c862534e4 (diff)
- 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
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java')
-rw-r--r--src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java32
1 files changed, 20 insertions, 12 deletions
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<ItemStack> jewelry = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> ores = new ArrayList<ItemStack>();
- public static HashMap<Item, ItemStack> oreToIngot = new HashMap<Item, ItemStack>();
+ public static HashMap<ItemStack, ItemStack> oreToIngot = new HashMap<ItemStack, ItemStack>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
private static ArrayList<ItemStack> items = new ArrayList<ItemStack>();
public static Random rand = new Random();
@@ -135,15 +137,19 @@ public class JewelrycraftUtil
Iterator<ItemStack> 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<ItemStack> 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<ItemStack> 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;
}
}