diff --git a/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/api/resource/conditions/v1/ResourceCondition.java b/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/api/resource/conditions/v1/ResourceCondition.java index 01785e98c0..e15aa76418 100644 --- a/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/api/resource/conditions/v1/ResourceCondition.java +++ b/fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric/api/resource/conditions/v1/ResourceCondition.java @@ -51,6 +51,9 @@ public interface ResourceCondition { static void addConditions(JsonObject baseObject, ResourceCondition... conditions) { if (baseObject.has(ResourceConditions.CONDITIONS_KEY)) { throw new IllegalArgumentException("Object already has a condition entry: " + baseObject); + } else if (conditions == null || conditions.length == 0) { + // Datagen might pass null conditions. + return; } baseObject.add(ResourceConditions.CONDITIONS_KEY, LIST_CODEC.encodeStart(JsonOps.INSTANCE, Arrays.asList(conditions)).getOrThrow());