Interface KeySet<T>

Type Parameters:
T - the type of the entries

@NonExtendable public interface KeySet<T>
A set of registry entries, either a tag or an explicit list of keys, as data packs declare it.

Resolving a tag requires the server registries: use Enchantments.isSupportedItem(TypedKey, TypedKey) or Enchantments.areCompatible(TypedKey, TypedKey) to test membership.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Returns true if this set neither refers to a tag nor lists any key.
    default boolean
    Returns true if this set refers to a tag.
    Returns the explicitly listed keys, empty for a tag.
    tag()
    Returns the tag this set refers to, such as minecraft:enchantable/weapon, or empty for an explicit list.
  • Method Details

    • tag

      Optional<TagKey<T>> tag()
      Returns the tag this set refers to, such as minecraft:enchantable/weapon, or empty for an explicit list.
      Returns:
      the tag this set refers to, such as minecraft:enchantable/weapon, or empty for an explicit list
      Since:
      0.1.0
    • keys

      Set<TypedKey<T>> keys()
      Returns the explicitly listed keys, empty for a tag.
      Returns:
      the explicitly listed keys, empty for a tag
      Since:
      0.1.0
    • isTag

      default boolean isTag()
      Returns true if this set refers to a tag.
      Returns:
      true if this set refers to a tag
      Since:
      0.1.0
    • isEmpty

      default boolean isEmpty()
      Returns true if this set neither refers to a tag nor lists any key.
      Returns:
      true if this set neither refers to a tag nor lists any key
      Since:
      0.1.0