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 -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> booleanis(JavaRegistryKey<T> registry, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet holderSet, int id) Checks and returns true if the givenholderSetcontains the givenid.default booleanChecks and returns true if the giventagcontains the givenid.default <T> booleanChecks and returns true if the giventagcontains the givenobject.it.unimi.dsi.fastutil.ints.IntListProvides a list of raw network IDs for the giventag.<T> JavaRegistry<T> registry(JavaRegistryKey<T> registryKey) Provides aJavaRegistryfor the givenregistryKey.default <T> List<T> Provides a list of objects for the giventag.Collection<Tag<?>> tags()Returns a collection of all currently loaded tags, across all loaded registries.tags(JavaRegistryKey<T> registry) Returns a stream of all currently loaded tags, for the given registry.
-
Method Details
-
registry
Provides aJavaRegistryfor the givenregistryKey.- Type Parameters:
T- the type of the registry- Parameters:
registryKey- the registry key to get aJavaRegistryfor- Returns:
- the
JavaRegistryfor theregistryKey
-
rawTag
Provides a list of raw network IDs for the giventag. 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
-
tags
Collection<Tag<?>> tags()Returns a collection of all currently loaded tags, across all loaded registries.- Returns:
- a collection of all currently loaded tags
-
tags
Returns a stream of all currently loaded tags, for the given registry.- Type Parameters:
T- the type of the registry- Parameters:
registry- the registry to look tags up for- Returns:
- a stream of all currently loaded tags for that registry
-
tag
Provides a list of objects for the giventag. 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
Checks and returns true if the giventagcontains the givenid.If the network ID of the object is unknown, prefer using the
is(Tag, Object)shorthand method.- Parameters:
tag- the tag to look upid- the id to check for- Returns:
- true if the
idwas present in thetag - See Also:
-
is
Checks and returns true if the giventagcontains the givenobject.- Type Parameters:
T- the type of the registry of the tag- Parameters:
tag- the tag to look upobject- the object to check for- Returns:
- true if the
objectwas present in thetag - 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 givenholderSetcontains the givenid.- Type Parameters:
T- the type of the registry- Parameters:
registry- the registry theholderSetbelongs toholderSet- the set. If null, this method will always return falseid- the id to check for- Returns:
- true if the specified network ID is in the given
HolderSet
-