use of net.moddingplayground.frame.api.toymaker.v0.generator.recipe.AbstractRecipeGenerator in project frame-fabric by moddingplayground.
the class RecipeProvider method createFileMapAdvancements.
public Map<Identifier, JsonElement> createFileMapAdvancements() {
Map<Identifier, JsonElement> map = Maps.newHashMap();
for (Supplier<AbstractRecipeGenerator> generator : this.getGenerators()) {
AbstractRecipeGenerator gen = generator.get();
gen.accept((id, factory) -> factory.offerTo(provider -> {
JsonObject json = provider.toAdvancementJson();
if (json != null && map.put(id, json) != null)
throw new IllegalStateException("Duplicate recipe advancement " + id);
}, id));
Identifier rootId = gen.getId("root");
if (!map.containsKey(rootId)) {
map.put(rootId, Advancement.Builder.create().criterion("impossible", new ImpossibleCriterion.Conditions()).toJson());
}
}
return map;
}
Aggregations