Class LoadConditions

java.lang.Object
net.darkhax.bookshelf.api.data.conditions.LoadConditions

public class LoadConditions extends Object
  • Constructor Details

    • LoadConditions

      public LoadConditions()
  • Method Details

    • register

      public static void register(net.minecraft.resources.ResourceLocation id, ILoadConditionSerializer<?> serializer)
      Registers a new load condition serializer.
      Parameters:
      id - The type ID of the serializer.
      serializer - The serializer instance.
    • getCondition

      public static ILoadCondition getCondition(com.google.gson.JsonObject conditionData)
      Reads a load condition from a JSON object.
      Parameters:
      conditionData - The condition data read from the JSON entry.
      Returns:
      The load condition that was deserialized.
    • getConditions

      public static ILoadCondition[] getConditions(com.google.gson.JsonElement conditionData)
      Reads one or more conditions from a JSON element. If the element is an object an array of 1 will be returned.
      Parameters:
      conditionData - The condition data read from the raw JSON entry.
      Returns:
      An array of load conditions read from the data.
    • canLoad

      public static boolean canLoad(com.google.gson.JsonObject rawJson)
      Tests if a raw JSON element can be loaded. This will search for the condition property and attempt to deserialize and test those conditions.
      Parameters:
      rawJson - The raw JSON data as read from the data/resource pack.
      Returns:
      Whether the JSON entry should be loaded or not.