Class TagUtil
java.lang.Object
net.fabricmc.fabric.api.tag.convention.v2.TagUtil
A Helper class for checking whether a
TagKey contains some entry.
This can be useful for TagKeys whose type has no easy way of querying if they are in a tag, such as Enchantments.
For dynamic registry entries, use isIn(DynamicRegistryManager, TagKey, Object) with a non-null dynamic registry manager.
For non-dynamic registry entries, the simpler isIn(TagKey, Object) can be used.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleanisIn(@Nullable DynamicRegistryManager registryManager, TagKey<T> tagKey, T entry) static <T> booleanSeeisIn(DynamicRegistryManager, TagKey, Object)to check tags that refer to entries in dynamic registries, such asBiomes.
-
Field Details
-
C_TAG_NAMESPACE
- See Also:
-
FABRIC_TAG_NAMESPACE
- See Also:
-
-
Method Details
-
isIn
SeeisIn(DynamicRegistryManager, TagKey, Object)to check tags that refer to entries in dynamic registries, such asBiomes.- Returns:
- if the entry is in the provided tag.
-
isIn
public static <T> boolean isIn(@Nullable @Nullable DynamicRegistryManager registryManager, TagKey<T> tagKey, T entry) - Parameters:
registryManager- the registry manager instance of the client or server. If the tag refers to entries within a dynamic registry, such asBiomes, this must be passed to correctly evaluate the tag. Otherwise, the registry is found by looking inRegistries.REGISTRIES.- Returns:
- if the entry is in the provided tag.
-