Interface ResourceCondition


public interface ResourceCondition
A resource condition. To create a custom condition type, implement this interface, call ResourceConditionType.create(Identifier, MapCodec) and create the type, then register via ResourceConditions.register(ResourceConditionType).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<ResourceCondition>
    A codec for a resource condition.
    static final com.mojang.serialization.Codec<ResourceCondition>
    A codec for parsing load conditions.
    static final com.mojang.serialization.Codec<List<ResourceCondition>>
    A codec for a list of conditions.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    test(@Nullable net.minecraft.resources.RegistryOps.RegistryInfoLookup registryInfo)
    Tests the condition.
  • Field Details

    • CODEC

      static final com.mojang.serialization.Codec<ResourceCondition> CODEC
      A codec for a resource condition. It is a map with a condition key denoting the ID of the condition, and any additional values required by the specific condition.
    • LIST_CODEC

      static final com.mojang.serialization.Codec<List<ResourceCondition>> LIST_CODEC
      A codec for a list of conditions.
    • CONDITION_CODEC

      static final com.mojang.serialization.Codec<ResourceCondition> CONDITION_CODEC
      A codec for parsing load conditions. Can either be an array of conditions or a single condition.
  • Method Details

    • getType

      ResourceConditionType<?> getType()
      Returns:
      the type of the condition
    • test

      boolean test(@Nullable net.minecraft.resources.RegistryOps.RegistryInfoLookup registryInfo)
      Tests the condition. The passed registry lookup, if any, includes all static and dynamic entries. However, the tags are not loaded yet.
      Parameters:
      registryInfo - the registry lookup, or null in case registry is unavailable
      Returns:
      whether the condition was successful
      Implementation Note:
      registryLookup should never be null for supported use cases (such as recipes or advancements). However, it may be null in client-side resources, or for non-vanilla pack types.