Class DefaultResourceConditions

java.lang.Object
net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions

public final class DefaultResourceConditions extends Object
Contains ConditionJsonProviders for resource conditions provided by fabric itself.
  • Method Details

    • not

      public static ConditionJsonProvider not(ConditionJsonProvider value)
      Creates a NOT condition that returns true if its child condition is false, and false if its child is true.
      API Note:
      This condition's ID is fabric:not, and takes one property, value, which is a condition.
    • and

      public static ConditionJsonProvider and(ConditionJsonProvider... values)
      Creates a condition that returns true if all of its child conditions are true.
      API Note:
      This condition's ID is fabric:and, and takes one property, values, which is an array of conditions.
    • or

      public static ConditionJsonProvider or(ConditionJsonProvider... values)
      Creates a condition that returns true if any of its child conditions are true.
      API Note:
      This condition's ID is fabric:or, and takes one property, values, which is an array of conditions.
    • allModsLoaded

      public static ConditionJsonProvider allModsLoaded(String... modIds)
      Creates a condition that returns true if all the passed mod ids correspond to a loaded mod.
      API Note:
      This condition's ID is fabric:all_mods_loaded, and takes one property, values, which is an array of string mod IDs.
    • anyModLoaded

      public static ConditionJsonProvider anyModLoaded(String... modIds)
      Creates a condition that returns true if at least one of the passed mod ids corresponds to a loaded mod.
      API Note:
      This condition's ID is fabric:any_mod_loaded, and takes one property, values, which is an array of string mod IDs.
    • blockTagsPopulated

      @SafeVarargs @Deprecated public static ConditionJsonProvider blockTagsPopulated(TagKey<Block>... tags)
      Create a condition that returns true if each of the passed block tags exists and has at least one element.
    • fluidTagsPopulated

      @SafeVarargs @Deprecated public static ConditionJsonProvider fluidTagsPopulated(TagKey<Fluid>... tags)
      Create a condition that returns true if each of the passed fluid tags exists and has at least one element.
    • itemTagsPopulated

      @SafeVarargs @Deprecated public static ConditionJsonProvider itemTagsPopulated(TagKey<Item>... tags)
      Create a condition that returns true if each of the passed item tags exists and has at least one element.
    • tagsPopulated

      @SafeVarargs public static <T> ConditionJsonProvider tagsPopulated(TagKey<T>... tags)
      Creates a condition that returns true if each of the passed tags exists and has at least one element. This works for any registries, and the registry ID of the tags is serialized to JSON as well as the tags.
      API Note:
      This condition's ID is fabric:tags_populated, and takes up to two properties: values, which is an array of string tag IDs, and registry, which is the ID of the registry of the tags. If registry is not provided, it defaults to minecraft:item.
    • featuresEnabled

      public static ConditionJsonProvider featuresEnabled(FeatureFlag... features)
      Creates a condition that returns true if all the passed features are enabled.
      Parameters:
      features - the features to check for
      API Note:
      This condition's ID is fabric:features_enabled, and takes one property: features, which is the array of the IDs of the feature flag to check.
    • itemsRegistered

      public static ConditionJsonProvider itemsRegistered(ItemConvertible... items)
      Creates a condition that returns true if all the passed items are registered (in Registries.ITEM).
      See Also:
    • registryContains

      @SafeVarargs public static <T> ConditionJsonProvider registryContains(Registry<T> registry, T... entries)
      Creates a condition that returns true if the registry contains all the passed entries, i.e. if all the passed registry entries are loaded.
      See Also:
    • registryContains

      @SafeVarargs public static <T> ConditionJsonProvider registryContains(RegistryKey<T>... entries)
      Creates a condition that returns true if all the passed registry entries are loaded.
      See Also:
    • registryContains

      public static <T> ConditionJsonProvider registryContains(RegistryKey<Registry<T>> registry, Identifier... entries)
      Creates a condition that returns true if all the passed registry entries are loaded. Dynamic registries are supported for server resources.
      API Note:
      This condition's ID is fabric:registry_contains, and takes up to two properties: values, which is an array of string registry entry IDs, and registry, which is the ID of the registry of the entries. If registry is not provided, it defaults to minecraft:item.
    • init

      static void init()