Interface ConditionJsonProvider
public interface ConditionJsonProvider
A resource condition and its parameters that can be serialized to JSON, meant for use in data generators.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the identifier of this condition.default com.google.gson.JsonObject
toJson()
Serialize this condition and its parameters to a new JSON object.static void
write
(com.google.gson.JsonObject conditionalObject, ConditionJsonProvider @Nullable ... conditions) Write the passed conditions to a JSON object in the "fabric:load_conditions" array.void
writeParameters
(com.google.gson.JsonObject object) Write the condition parameters (everything except the"condition": ...
entry).
-
Method Details
-
write
static void write(com.google.gson.JsonObject conditionalObject, ConditionJsonProvider @Nullable ... conditions) Write the passed conditions to a JSON object in the "fabric:load_conditions" array.- Throws:
IllegalArgumentException
- if the JSON object already contains that array
-
toJson
default com.google.gson.JsonObject toJson()Serialize this condition and its parameters to a new JSON object. -
getConditionId
Identifier getConditionId()Returns the identifier of this condition. This is only for use bytoJson()
to write it.- Returns:
- the identifier of this condition
-
writeParameters
void writeParameters(com.google.gson.JsonObject object) Write the condition parameters (everything except the"condition": ...
entry). This is only for use bytoJson()
.
-