Class LoadConditions

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

public class LoadConditions extends Object
  • Field Details

    • LOAD_CONDITION_TAG

      public static final String LOAD_CONDITION_TAG
    • CONDITION_CODEC

      public static final com.mojang.serialization.Codec<ILoadCondition> CONDITION_CODEC
    • CODEC_HELPER

      public static final MapCodecHelper<ILoadCondition> CODEC_HELPER
  • Constructor Details

    • LoadConditions

      public LoadConditions()
  • Method Details

    • getType

      @Nullable public static @Nullable ConditionType getType(net.minecraft.resources.ResourceLocation id)
    • register

      public static <T extends ILoadCondition> ConditionType register(net.minecraft.resources.ResourceLocation id, com.mojang.serialization.MapCodec<T> codec)
    • 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.