use of net.minecraft.data.HashCache in project MinecraftForge by MinecraftForge.
the class GlobalLootModifierProvider method run.
@Override
public void run(HashCache cache) throws IOException {
start();
Path forgePath = gen.getOutputFolder().resolve("data/forge/loot_modifiers/global_loot_modifiers.json");
String modPath = "data/" + modid + "/loot_modifiers/";
List<ResourceLocation> entries = new ArrayList<>();
toSerialize.forEach(LamdbaExceptionUtils.rethrowBiConsumer((name, pair) -> {
entries.add(new ResourceLocation(modid, name));
Path modifierPath = gen.getOutputFolder().resolve(modPath + name + ".json");
JsonObject json = pair.getB();
json.addProperty("type", pair.getA().getRegistryName().toString());
DataProvider.save(GSON, cache, json, modifierPath);
}));
JsonObject forgeJson = new JsonObject();
forgeJson.addProperty("replace", this.replace);
forgeJson.add("entries", GSON.toJsonTree(entries.stream().map(ResourceLocation::toString).collect(Collectors.toList())));
DataProvider.save(GSON, cache, forgeJson, forgePath);
}
Aggregations