Interface TagSet<T extends Keyed>
- Type Parameters:
T- the Bukkit type of the elements
- All Superinterfaces:
Keyed, Registerable<TagSet<T>>, Wrapper
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 TypeMethodDescriptionappend()Binds this tag set's elements into the tag already bound under its key, keeping everything that tag already held, and creating the tag if nothing is bound under that key yet.<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<Biome> biomes()Creates a new builder for biome tag sets.Creates a biome tag set from anEitherof explicit biomes or a named tag.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.decodeBiomes(Object minecraftHolderSet) Reads a Minecraft biome holder set, preserving a named tag when present.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) Creates a tag set of explicit biomes.ofBiomes(@Nullable ResourceKey resourceKey, Biome... biomes) Creates a tag set of explicit biomes.ofBiomes(@Nullable ResourceKey resourceKey, Set<Biome> biomes) Creates a tag set of explicit biomes.Creates a tag set of explicit biomes.ofBiomeTag(ResourceKey key) Creates a tag set referencing a named biome tag.ofBiomeTag(TagKey tag) Creates a tag set referencing a named biome tag.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.register()Binds this tag set under its own key, which nothing else may have claimed.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 Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
register
Binds this tag set under its own key, which nothing else may have claimed.- Specified by:
registerin interfaceRegisterable<T extends Keyed>- Returns:
- this tag set
- Throws:
IllegalArgumentException- if a tag is already bound under this key; useappend()to add to one instead- Since:
- 3.1.0
-
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
-
append
Binds this tag set's elements into the tag already bound under its key, keeping everything that tag already held, and creating the tag if nothing is bound under that key yet.This is the additive counterpart to
register(), which insists on a key nothing has claimed. Use it to add to a tag Minecraft or another plugin owns — putting a custom biome intominecraft:has_structure/village_plainsso villages generate there, for instance.A tag the registry has handed out before is rebound in place, so whatever holds it already sees the new members straight away: a structure loaded from a data pack resolved its biome tag through the registry, so appending to that tag retargets the structure in a world that is already running, with nothing reloaded. A tag that exists only because Wyck created it, and that nothing has looked up, is replaced rather than rebound — re-read it after appending instead of holding the set across calls.
Additive membership in a
minecraft:tag is not an override: it only ever changes behavior where the elements it adds are present, so adding your own biomes to a vanilla biome tag cannot affect a world those biomes do not occur in.- Returns:
- this tag set
- Throws:
IllegalStateException- if this tag set has no resource key, or references a named tag instead of holding explicit elements- Since:
- 3.4.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
-
ofBiomes
-
ofBiomes
-
ofBiomes
-
ofBiomes
-
ofBiomeTag
-
ofBiomeTag
Creates a tag set referencing a named biome tag.- Parameters:
key- the biome tag identifier- Returns:
- a new biome tag set
- Since:
- 3.4.0
-
ofTag
-
blocks
-
timelines
-
biomes
-
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
-
decodeBiomes
-
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
-
biomes
Creates a new builder for biome tag sets.- Returns:
- a new builder
- Since:
- 3.4.0
-