public static void traverseTags_treatitems(Tag orig, boolean convert) { if (orig instanceof CompoundTag) { CompoundTag ctagorig = (CompoundTag) orig; Collection alltags = ctagorig.getAllTags(); Iterator it = alltags.iterator(); level++; while (it.hasNext()) { traverseTags_treatitems((Tag) it.next(), convert); } level--; } if (orig instanceof ListTag) { ListTag listTagorig = (ListTag) orig; Field list = null; Iterator it = null; try { list = ListTag.class.getDeclaredField("list"); list.setAccessible(true); it = ((List) list.get(listTagorig)).iterator(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } level++; while (it.hasNext()) { // Logger.log(new String(new char[level]).replace("\0", "-")+orig.getId()); Tag tag = (Tag) it.next(); if (tag instanceof CompoundTag) { CompoundTag ctag = (CompoundTag) tag; if (listTagorig.getName().toLowerCase().indexOf("item") == -1) { traverseTags_treatitems(ctag, convert); } else { int ntype = 1; int id0 = (int) ctag.getShort("id"); int id1 = (int) (Integer) ConverterMain.options.getconvertmaps()[1].get(id0)[0]; count(ntype, id0, id1, convert); if (convert) { int typefound = (int) (Integer) ConverterMain.options.getconvertmaps()[1].get(id0)[1]; if (typefound >= 0) { if (id0 != id1 && !converteds[ntype].contains(id0)) { ctag.putShort("id", (short) id1); } } } } } } level--; } // Logger.log(new String(new char[level]).replace("\0", "-")+orig.getId()); }