Class TagUtil
java.lang.Object
net.fabricmc.fabric.api.tag.convention.v1.TagUtil
A Helper class for checking whether a
TagKey
contains some entry.
This can be useful for TagKey
s whose type has no easy way of querying if they are in a tag, such as Enchantment
s.
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> boolean
isIn
(@Nullable DynamicRegistryManager registryManager, TagKey<T> tagKey, T entry) static <T> boolean
SeeisIn(DynamicRegistryManager, TagKey, Object)
to check tags that refer to entries in dynamic registries, such asBiome
s.
-
Method Details
-
isIn
SeeisIn(DynamicRegistryManager, TagKey, Object)
to check tags that refer to entries in dynamic registries, such asBiome
s.- 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 asBiome
s, this must be passed to correctly evaluate the tag. Otherwise, the registry is found by looking inRegistry.REGISTRIES
.- Returns:
- if the entry is in the provided tag.
-