Class DefaultResourceConditions
java.lang.Object
net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions
Contains
ConditionJsonProviders for resource conditions provided by fabric itself.-
Method Summary
Modifier and TypeMethodDescriptionstatic ConditionJsonProviderallModsLoaded(String... modIds) Creates a condition that returns true if all the passed mod ids correspond to a loaded mod.static ConditionJsonProviderand(ConditionJsonProvider... values) Creates a condition that returns true if all of its child conditions are true.static ConditionJsonProvideranyModLoaded(String... modIds) Creates a condition that returns true if at least one of the passed mod ids corresponds to a loaded mod.static ConditionJsonProviderblockTagsPopulated(TagKey<Block>... tags) Deprecated.static ConditionJsonProviderfeaturesEnabled(FeatureFlag... features) Creates a condition that returns true if all the passed features are enabled.static ConditionJsonProviderfluidTagsPopulated(TagKey<Fluid>... tags) Deprecated.(package private) static voidinit()static ConditionJsonProvideritemsRegistered(ItemConvertible... items) Creates a condition that returns true if all the passed items are registered (inRegistries.ITEM).static ConditionJsonProvideritemTagsPopulated(TagKey<Item>... tags) Deprecated.static ConditionJsonProvidernot(ConditionJsonProvider value) Creates a NOT condition that returns true if its child condition is false, and false if its child is true.static ConditionJsonProvideror(ConditionJsonProvider... values) Creates a condition that returns true if any of its child conditions are true.static <T> ConditionJsonProviderregistryContains(Registry<T> registry, T... entries) Creates a condition that returns true if the registry contains all the passed entries, i.e.static <T> ConditionJsonProviderregistryContains(RegistryKey<Registry<T>> registry, Identifier... entries) Creates a condition that returns true if all the passed registry entries are loaded.static <T> ConditionJsonProviderregistryContains(RegistryKey<T>... entries) Creates a condition that returns true if all the passed registry entries are loaded.static <T> ConditionJsonProvidertagsPopulated(TagKey<T>... tags) Creates a condition that returns true if each of the passed tags exists and has at least one element.
-
Method Details
-
not
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
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
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
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
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) Deprecated.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) Deprecated.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) Deprecated.Create a condition that returns true if each of the passed item tags exists and has at least one element. -
tagsPopulated
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, andregistry, which is the ID of the registry of the tags. Ifregistryis not provided, it defaults tominecraft:item.
-
featuresEnabled
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
Creates a condition that returns true if all the passed items are registered (inRegistries.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
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, andregistry, which is the ID of the registry of the entries. Ifregistryis not provided, it defaults tominecraft:item.
-
init
static void init()
-
tagsPopulated(net.minecraft.registry.tag.TagKey<T>...)instead.