From 4774926ed9703b000ecbcff69636dd7ea4abf5d6 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Tue, 28 Apr 2015 23:46:37 +0100 Subject: Fixed the mod from crashing with other mods --- .../jewelrycraft/util/JewelrycraftUtil.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 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 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 ores = new ArrayList(); public static HashMap oreToIngot = new HashMap(); public static ArrayList jamcraftPlayers = new ArrayList(); + private static ArrayList items = new ArrayList(); 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 items = new ArrayList(); - 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."); + } } } -- cgit v1.2.3