private static void parseModItems() { HashMap<String, ItemStackSet> modSubsets = new HashMap<String, ItemStackSet>(); for (Item item : (Iterable<Item>) Item.itemRegistry) { UniqueIdentifier ident = GameRegistry.findUniqueIdentifierFor(item); if(ident == null) { NEIClientConfig.logger.error("Failed to find identifier for: "+item); continue; } String modId = GameRegistry.findUniqueIdentifierFor(item).modId; itemOwners.put(item, modId); ItemStackSet itemset = modSubsets.get(modId); if(itemset == null) modSubsets.put(modId, itemset = new ItemStackSet()); itemset.with(item); } API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft")); for(Entry<String, ItemStackSet> entry : modSubsets.entrySet()) { ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey()); if(mc == null) NEIClientConfig.logger.error("Missing container for "+entry.getKey()); else API.addSubset("Mod."+mc.getName(), entry.getValue()); } }
void classifyItems() { Core.logFine("[parasieve] Classifying items"); HashMap<String, Short> modMap = new HashMap(); short seen = 1; Arrays.fill(itemId2modIndex, (short) 0); for (Item item : (Iterable<Item>) Item.itemRegistry) { if (item == null) { continue; } NORELEASE.fixme("Not ported propertly"); UniqueIdentifier ui; try { ui = GameRegistry.findUniqueIdentifierFor(item); } catch (Throwable e) { Core.logWarning("Error looking up item: " + item); e.printStackTrace(); continue; } String modName = null; if (ui != null) { modName = ui.modId; } if (modName == null) { modName = "vanilla?"; } Short val = modMap.get(modName); if (val == null) { modMap.put(modName, seen); val = seen; seen++; } int id = DataUtil.getId(item); if (id >= itemId2modIndex.length) { itemId2modIndex = Arrays.copyOf(itemId2modIndex, id + 1024); } itemId2modIndex[id] = val; } Core.logFine("[parasieve] Done"); }