Interface TagSet<T extends Keyed>
- Type Parameters:
T- the Bukkit type of the elements
- All Superinterfaces:
Keyed, Registerable<TagSet<T>>, Wrapper
@NullMarked
@AsOf("3.1.0")
public interface TagSet<T extends Keyed>
extends Wrapper, Keyed, Registerable<TagSet<T>>
An abstraction over a set of registry entries that is either an explicit
Set of elements or a
reference to a named tag (ResourceKey). It mirrors Minecraft's HolderSet, which is likewise
an inline list, or a tag. When this is a set of elements, this can be registered to a registry.- Since:
- 3.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classTagSet.Builder<T extends Keyed>Creates a new builder. -
Method Summary
Modifier and TypeMethodDescription<U> UIf this is a holder set, returns the underlying set.<U> UasTagKey()If this is a tag key, returns the underlying tag key.static TagSet.Builder<Material> blocks()Creates a new builder for block tag sets.Creates a block tag set from anEitherof explicit materials or a named tag.static <T extends Keyed>
TagSet.Builder<T> builder()Creates a new builder.decodeBlocks(Object minecraftHolderSet) Reads a Minecraft block holder set, preserving a named tag when present.default booleanChecks if this is a block tag set.default booleanisTag()Checks if this is a tag set.of(@Nullable ResourceKey resourceKey, RegistryId registry, Either<Set<T>, TagKey> value) of(@Nullable ResourceKey resourceKey, RegistryId registry, Set<T> elements) ofBlocks(@Nullable ResourceKey resourceKey, Set<Material> blocks) Creates a tag set of explicit block materials.ofBlocks(@Nullable ResourceKey resourceKey, Material... blocks) Creates a tag set of explicit block materials.Creates a tag set of explicit block materials.Creates a tag set of explicit block materials.ofBlockTag(ResourceKey key) Creates a key set referencing a named block key.ofBlockTag(TagKey tag) Creates a tag set referencing a named block tag.Creates a tag set referencing the given named tag.The registry the elements of this tag set resolve against.The key of the tag set.static TagSet.Builder<Timeline> Creates a new builder for timeline tag sets.Creates a tag set from anEitherof explicit tags or a named tag.default TagSet.Builder<T> Creates a new builder from this tag set.value()The contents of this tag set: either an explicit set of elements, or a reference to a named tag.Methods inherited from interface Registerable
registerMethods inherited from interface Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
resourceKey
The key of the tag set.- Returns:
- the tag set key
- Since:
- 3.1.0
-
registryId
The registry the elements of this tag set resolve against.- Returns:
- the registry discriminator
- Since:
- 3.1.0
-
value
-
asHolderSet
If this is a holder set, returns the underlying set. If this is a tag key, returns the underlying set for that key.- Type Parameters:
U- the type of the underlying set- Returns:
- the underlying set, if present
- Since:
- 3.1.0
-
asTagKey
If this is a tag key, returns the underlying tag key. If this is a holder set, tries to find a tag key which matches the items in this set, otherwise throws.- Type Parameters:
U- the type of the underlying tag key- Returns:
- the underlying tag key, if present
- Throws:
IllegalStateException- if this is a holder set, and no matching tag key can be found- Since:
- 3.1.0
-
isBlockSet
Checks if this is a block tag set.- Returns:
- true if this is a block tag set, false otherwise
- Since:
- 3.1.0
-
isTag
Checks if this is a tag set.- Returns:
- true if this is a tag set, false otherwise
- Since:
- 3.1.0
-
ofBlocks
-
ofBlocks
-
ofBlocks
-
ofBlocks
-
ofBlockTag
-
ofBlockTag
Creates a key set referencing a named block key.- Parameters:
key- the block tag key- Returns:
- a new block key set
- Since:
- 3.1.0
-
ofTag
-
blocks
-
timelines
-
of
@Internal static <T extends Keyed> TagSet<T> of(@Nullable ResourceKey resourceKey, RegistryId registry, Set<T> elements) -
of
@Internal static <T extends Keyed> TagSet<T> of(@Nullable ResourceKey resourceKey, RegistryId registry, Either<Set<T>, TagKey> value) -
decodeBlocks
-
toBuilder
Creates a new builder from this tag set.- Returns:
- a new builder
- Since:
- 3.1.0
-
builder
Creates a new builder.- Type Parameters:
T- the Bukkit type of the elements- Returns:
- a new builder
- Since:
- 3.1.0
-
blocks
Creates a new builder for block tag sets.- Returns:
- a new builder
- Since:
- 3.1.0
-
timelines
Creates a new builder for timeline tag sets.- Returns:
- a new builder
- Since:
- 3.2.0
-