IRecipeConditions forge:and and forge:false (#4017)
This commit is contained in:
parent
17a714f7fd
commit
e056c79ec7
1 changed files with 14 additions and 0 deletions
|
@ -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", "");
|
||||
|
|
Loading…
Reference in a new issue