Add Registry#getTagValues (#12603)

This commit is contained in:
Strokkur24
2025-06-07 03:23:02 +02:00
committed by GitHub
parent 4eda045b15
commit 7ebc94c2a6
2 changed files with 19 additions and 0 deletions

View File

@@ -491,10 +491,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @throws NoSuchElementException if no tag with the given key is found
* @throws UnsupportedOperationException if this registry doesn't have or support tags
* @see #hasTag(TagKey)
* @see #getTagValues(TagKey)
*/
@ApiStatus.Experimental
Tag<T> getTag(TagKey<T> key);
/**
* Gets the named registry set (tag) for the given key and resolves it with this registry.
*
* @param key the key to get the tag for
* @return the resolved values
* @throws NoSuchElementException if no tag with the given key is found
* @throws UnsupportedOperationException if this registry doesn't have or support tags
* @see #getTag(TagKey)
* @see Tag#resolve(Registry)
*/
@ApiStatus.Experimental
default Collection<T> getTagValues(TagKey<T> key) {
Tag<T> tag = getTag(key);
return tag.resolve(this);
}
/**
* Gets all the tags in this registry.
*