Interface ConditionJsonProvider


public interface ConditionJsonProvider
A resource condition and its parameters that can be serialized to JSON, meant for use in data generators.
  • Method Details

    • write

      static void write(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 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 by toJson() to write it.
      Returns:
      the identifier of this condition
    • writeParameters

      void writeParameters(JsonObject object)
      Write the condition parameters (everything except the "condition": ... entry). This is only for use by toJson().