IRecipeConditions forge:and and forge:false (#4017)

This commit is contained in:
TechnicianLP 2017-06-20 11:19:14 +02:00 committed by LexManos
parent 17a714f7fd
commit e056c79ec7

View file

@ -432,6 +432,20 @@ public class CraftingHelper {
}
return () -> children.stream().anyMatch(c -> c.getAsBoolean());
});
registerC("forge:and", (context, json) -> {
JsonArray values = JsonUtils.getJsonArray(json, "values");
List<BooleanSupplier> children = Lists.newArrayList();
for (JsonElement j : values)
{
if (!j.isJsonObject())
throw new JsonSyntaxException("And condition values must be an array of JsonObjects");
children.add(CraftingHelper.getCondition(j.getAsJsonObject(), context));
}
return () -> children.stream().allMatch(c -> c.getAsBoolean());
});
registerC("forge:false", (context, json) -> {
return () -> false;
});
registerR("minecraft:crafting_shaped", (context, json) -> {
String group = JsonUtils.getString(json, "group", "");