Package org.bukkit
Interface Registry<T extends Keyed>
- Type Parameters:
T
- type of item in the registry
- All Superinterfaces:
Iterable<T>
- All Known Implementing Classes:
Registry.SimpleRegistry
Represents a registry of Bukkit objects that may be retrieved by
NamespacedKey
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Registry.SimpleRegistry<T extends Enum<T> & Keyed>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Registry
<Advancement> Server advancements.Deprecated.Attribute.static final Registry
<PatternType> Deprecated.Server block types.static final Registry
<KeyedBossBar> Custom boss bars.Server cat types.static final Registry
<DamageType> Deprecated.static final Registry
<DataComponentType> static final Registry
<PotionEffectType> Server mob effects.static final Registry
<Enchantment> Deprecated.static final Registry
<EntityType> Server entity types.Server fluids.static final Registry
<Frog.Variant> Frog variants.Game events.static final Registry
<MusicInstrument> Deprecated.Server item types.static final Registry
<JukeboxSong> static final Registry
<LootTables> Default server loot tables.static final Registry
<MapCursor.Type> Map cursor types.Server materials.Memory Keys.Server menus.Server particles.static final Registry
<PotionType> Server potions.static final Registry
<PotionEffectType> Potion effect types.Sound keys.Server statistics.Deprecated.static final Registry
<StructureType> Server structure types.static final Registry
<TrimMaterial> static final Registry
<TrimPattern> static final Registry
<Villager.Profession> Villager profession.static final Registry
<Villager.Type> Villager type.static final Registry
<Wolf.Variant> -
Method Summary
Modifier and TypeMethodDescriptiondefault T
Get the object by its typed key.default T
Get the object by its key.get
(@NotNull NamespacedKey key) Get the object by its key.default @Nullable NamespacedKey
Get the key for this object.default @NotNull NamespacedKey
getKeyOrThrow
(T value) Gets the key for this object or throws if it doesn't exist.default T
getOrThrow
(@NotNull TypedKey<T> key) Gets the object by its key or throws if it doesn't exist.default T
getOrThrow
(@NotNull Key key) Gets the object by its key or throws if it doesn't exist.Get the object by its key.Gets the named registry set (tag) for the given key.default boolean
Checks if this registry has a tag with the given key.default T
Deprecated, for removal: This API element is subject to removal in a future version.this method's behavior is broken and not useful.stream()
Returns a new stream, which contains all registry items, which are registered to the registry.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
ADVANCEMENT
Server advancements.- See Also:
-
ART
Deprecated.Server art.- See Also:
-
ATTRIBUTE
Attribute.- See Also:
-
BANNER_PATTERN
Deprecated.Server banner patterns.- See Also:
-
BIOME
Deprecated.Server biomes.- See Also:
-
BLOCK
Server block types.- See Also:
- API Note:
- BlockType is not ready for public usage yet
-
BOSS_BARS
Custom boss bars.- See Also:
-
CAT_VARIANT
Server cat types.- See Also:
-
ENCHANTMENT
Deprecated.Server enchantments.- See Also:
-
ENTITY_TYPE
Server entity types.- See Also:
-
INSTRUMENT
Deprecated.Server instruments.- See Also:
-
ITEM
Server item types.- See Also:
- API Note:
- ItemType is not ready for public usage yet
-
LOOT_TABLES
Default server loot tables.- See Also:
-
MATERIAL
Server materials.- See Also:
-
MENU
Server menus.- See Also:
-
EFFECT
Server mob effects.- See Also:
-
PARTICLE_TYPE
Server particles.- See Also:
-
POTION
Server potions.- See Also:
-
STATISTIC
Server statistics.- See Also:
-
STRUCTURE
Deprecated.Server structures.- See Also:
-
STRUCTURE_TYPE
Server structure types.- See Also:
-
SOUNDS
Sound keys.- See Also:
-
TRIM_MATERIAL
Deprecated.Trim materials.- See Also:
-
TRIM_PATTERN
Deprecated.Trim patterns.- See Also:
-
DAMAGE_TYPE
Deprecated.Damage types.- See Also:
-
JUKEBOX_SONG
Deprecated.Jukebox songs.- See Also:
-
VILLAGER_PROFESSION
Villager profession.- See Also:
-
VILLAGER_TYPE
Villager type.- See Also:
-
MEMORY_MODULE_TYPE
Memory Keys.- See Also:
-
FLUID
Server fluids.- See Also:
-
FROG_VARIANT
Frog variants.- See Also:
-
WOLF_VARIANT
Deprecated.Wolf variants.- See Also:
-
MAP_DECORATION_TYPE
Map cursor types.- See Also:
-
GAME_EVENT
Game events.- See Also:
-
POTION_EFFECT_TYPE
Potion effect types.- See Also:
-
DATA_COMPONENT_TYPE
-
-
Method Details
-
get
Get the object by its key.- Parameters:
key
- non-null key- Returns:
- item or null if does not exist
-
get
Get the object by its key.- Parameters:
key
- non-null key- Returns:
- item or null if it does not exist
-
get
Get the object by its typed key.- Parameters:
typedKey
- non-null typed key- Returns:
- item or null if it does not exist
-
getOrThrow
Gets the object by its key or throws if it doesn't exist.- Parameters:
key
- the key to get the object of in this registry- Returns:
- the object for the key
- Throws:
NoSuchElementException
- if the key doesn't point to an object in the registry
-
getOrThrow
Gets the object by its key or throws if it doesn't exist.- Parameters:
key
- the key to get the object of in this registry- Returns:
- the object for the key
- Throws:
NoSuchElementException
- if the key doesn't point to an object in the registry
-
getKeyOrThrow
Gets the key for this object or throws if it doesn't exist.Some types can exist without being in a registry and such will have no key associated with them. This method throw an exception if it isn't in this registry.
- Parameters:
value
- the value to get the key of in this registry- Returns:
- the key for the value
- Throws:
NoSuchElementException
- if the value doesn't exist in this registry- See Also:
-
getKey
Get the key for this object.Some types can exist without being in a registry and such will have no key associated with them. This method will return null.
- Parameters:
value
- the value to get the key of in this registry- Returns:
- the key for the value or null if not in the registry
- See Also:
-
hasTag
Checks if this registry has a tag with the given key.- Parameters:
key
- the key to check for- Returns:
- true if this registry has a tag with the given key, false otherwise
- See Also:
-
getTag
Gets the named registry set (tag) for the given key.- Parameters:
key
- the key to get the tag for- Returns:
- the tag for the key
- Throws:
NoSuchElementException
- if no tag with the given key is foundUnsupportedOperationException
- if this registry doesn't have or support tags- See Also:
-
getOrThrow
Get the object by its key. If there is no object with the given key, an exception will be thrown.- Parameters:
key
- to get the object from- Returns:
- object with the given key
- Throws:
IllegalArgumentException
- if there is no object with the given key
-
stream
Returns a new stream, which contains all registry items, which are registered to the registry.- Returns:
- a stream of all registry items
-
match
Deprecated, for removal: This API element is subject to removal in a future version.this method's behavior is broken and not useful. If you want to get an object based on its vanilla name, or a key, wrap it in aNamespacedKey
object and useget(NamespacedKey)
Attempts to match the registered object with the given key.This will attempt to find a reasonable match based on the provided input and may do so through unspecified means.
- Parameters:
input
- non-null input- Returns:
- registered object or null if does not exist
-
RegistryAccess.getRegistry(io.papermc.paper.registry.RegistryKey)
withRegistryKey.PAINTING_VARIANT