Interface JavaRegistryProvider

All Known Implementing Classes:
JavaRegistryTagCache

public interface JavaRegistryProvider
Provides access to a JavaRegistry for each registry defined in JavaRegistries, a well as access to tags for each registry.

This interface also has utility methods for checking if a registry tag contains an object. Alternatively, you can use one of the following shorthand methods for blocks and items:

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> boolean
    is(JavaRegistryKey<T> registry, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, int id)
    Checks and returns true if the given holderSet contains the given id.
    default boolean
    is(Tag<?> tag, int id)
    Checks and returns true if the given tag contains the given id.
    default <T> boolean
    is(Tag<T> tag, T object)
    Checks and returns true if the given tag contains the given object.
    it.unimi.dsi.fastutil.ints.IntList
    rawTag(Tag<?> tag)
    Provides a list of raw network IDs for the given tag.
    <T> JavaRegistry<T>
    registry(JavaRegistryKey<T> registryKey)
    Provides a JavaRegistry for the given registryKey.
    default <T> List<T>
    tag(Tag<T> tag)
    Provides a list of objects for the given tag.
  • Method Details

    • registry

      <T> JavaRegistry<T> registry(JavaRegistryKey<T> registryKey)
      Provides a JavaRegistry for the given registryKey.
      Type Parameters:
      T - the type of the registry
      Parameters:
      registryKey - the registry key to get a JavaRegistry for
      Returns:
      the JavaRegistry for the registryKey
    • rawTag

      it.unimi.dsi.fastutil.ints.IntList rawTag(Tag<?> tag)
      Provides a list of raw network IDs for the given tag. This can be an empty list.

      Generally, prefer using tag(Tag) as it maps the network IDs into a list of objects.

      Parameters:
      tag - the tag to look up
      Returns:
      the list of raw network IDs the tag holds
    • tag

      default <T> List<T> tag(Tag<T> tag)
      Provides a list of objects for the given tag. This can be an empty list.
      Type Parameters:
      T - the type of the registry of the tag
      Parameters:
      tag - the tag to look up
      Returns:
      the list of objects the tag holds
    • is

      default boolean is(Tag<?> tag, int id)
      Checks and returns true if the given tag contains the given id.

      If the network ID of the object is unknown, prefer using the is(Tag, Object) shorthand method.

      Parameters:
      tag - the tag to look up
      id - the id to check for
      Returns:
      true if the id was present in the tag
      See Also:
    • is

      default <T> boolean is(Tag<T> tag, T object)
      Checks and returns true if the given tag contains the given object.
      Type Parameters:
      T - the type of the registry of the tag
      Parameters:
      tag - the tag to look up
      object - the object to check for
      Returns:
      true if the object was present in the tag
      See Also:
    • is

      default <T> boolean is(JavaRegistryKey<T> registry, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, int id)
      Checks and returns true if the given holderSet contains the given id.
      Type Parameters:
      T - the type of the registry
      Parameters:
      registry - the registry the holderSet belongs to
      holderSet - the set. If null, this method will always return false
      id - the id to check for
      Returns:
      true if the specified network ID is in the given HolderSet