public static void dumpFile(RegistryNamespaced namespaced, String name) throws IOException { File output = new File(dump_dir, name + ".dump"); Map<Impl, Integer> map = dumpId(namespaced); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(output))); for (Entry<Impl, Integer> entry : map.entrySet()) { writer.write(entry.getValue() + " - " + entry.getKey().getRegistryName()); writer.newLine(); } writer.close(); }
public static Map<Impl, Integer> dumpId(RegistryNamespaced<ResourceLocation, Impl> namespaced) { return StreamSupport.stream(namespaced.spliterator(), false).collect(Maps::newLinkedHashMap, (map, impl) -> map.put(impl, namespaced.getIDForObject(impl)), Map::putAll); }