java.lang.Object
net.fabricmc.fabric.api.tag.convention.v1.TagUtil

public final class TagUtil extends Object
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.

  • Method Details

    • isIn

      public static <T> boolean isIn(TagKey<T> tagKey, T entry)
      See isIn(DynamicRegistryManager, TagKey, Object) to check tags that refer to entries in dynamic registries, such as Biomes.
      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 as Biomes, this must be passed to correctly evaluate the tag. Otherwise, the registry is found by looking in Registry.REGISTRIES.
      Returns:
      if the entry is in the provided tag.