diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-04-28 23:46:37 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-04-28 23:46:37 +0100 |
| commit | 4774926ed9703b000ecbcff69636dd7ea4abf5d6 (patch) | |
| tree | 86cb89eac4a22c9509b25f4cc4f974611fecf387 /src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java | |
| parent | 17c10d87711b3e587c5fb2fb55cdc4eb8a61b75a (diff) | |
Fixed the mod from crashing with other mods
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index a1a6eb9..a9d0a13 100644 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -28,6 +28,7 @@ public class JewelrycraftUtil public static ArrayList<ItemStack> ores = new ArrayList<ItemStack>(); public static HashMap<Item, ItemStack> oreToIngot = new HashMap<Item, ItemStack>(); public static ArrayList<String> jamcraftPlayers = new ArrayList<String>(); + private static ArrayList<ItemStack> items = new ArrayList<ItemStack>(); public static Random rand = new Random(); /** @@ -51,15 +52,17 @@ public class JewelrycraftUtil jewelry.add(new ItemStack(ItemList.bracelet)); jewelry.add(new ItemStack(ItemList.earrings)); for(Object item: GameData.getItemRegistry()){ - ArrayList<ItemStack> items = new ArrayList<ItemStack>(); - if (Loader.isModLoaded("Mantle") && ((Item)item).getUnlocalizedName().equals("Mantle:item.mantle.manual")) continue; - if (Loader.isModLoaded("Fossil/Archeology") && ((Item)item).getUnlocalizedName().equals("Fossil/Archeology") && (((Item)item).getUnlocalizedName().equals("legBone") || - ((Item)item).getUnlocalizedName().equals("uniqueItem") || ((Item)item).getUnlocalizedName().equals("foot") || ((Item)item).getUnlocalizedName().equals("skull") || - ((Item)item).getUnlocalizedName().equals("armBone") || ((Item)item).getUnlocalizedName().equals("dinoRibCage") || ((Item)item).getUnlocalizedName().equals("vertebrae"))) continue; - if (item != null && ((Item)item).getHasSubtypes()) ((Item)item).getSubItems((Item)item, null, items); - else objects.add(new ItemStack((Item)item)); - - if (!items.isEmpty()) objects.addAll(items); + if (Loader.isModLoaded("Mantle") && ((Item)item).getUnlocalizedName().equals("Mantle:item.mantle.manual")) continue; + try{ + if (item != null && (Item)item != null && ((Item)item).getHasSubtypes()){ + ((Item)item).getSubItems((Item)item, ((Item)item).getCreativeTab(), items); + }else objects.add(new ItemStack((Item)item)); + if (!items.isEmpty()) objects.addAll(items); + items.removeAll(items); + } + catch(Exception e){ + JewelrycraftMod.logger.info("Error, tried to add subtypes of item " + ((Item)item).getUnlocalizedName() + "\nItem is not added in the list."); + } } } |
