Interface RegistryAware

All Known Subinterfaces:
Art, Attribute, Biome, BlockType, BlockType.Typed<B>, Cat.Type, DamageType, Fluid, Frog.Variant, ItemType, ItemType.Typed<M>, JukeboxSong, MapCursor.Type, MenuType, MenuType.Typed<V,B>, PatternType, Sound, TrimMaterial, TrimPattern, Villager.Profession, Villager.Type, Wolf.Variant
All Known Implementing Classes:
Enchantment, EnchantmentWrapper, EntityType, GameEvent, Material, MemoryKey, MusicInstrument, Particle, PotionEffectType, PotionEffectTypeWrapper, PotionType, Structure, StructureType

public interface RegistryAware
Indicates that instances of a class may be registered to the server and have a key associated with them.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the key of this instance if it is registered otherwise returns null.
    Gets the key of this instance if it is registered otherwise throws an error.
    boolean
    Returns whether this instance is register in a registry and therefore has a key or not.
  • Method Details

    • getKeyOrThrow

      @NotNull NamespacedKey getKeyOrThrow()
      Gets the key of this instance if it is registered otherwise throws an error.
      This is a convenience method and plugins should always check isRegistered() before using this method.
      Returns:
      the key with which this instance is registered.
      Throws:
      IllegalStateException - if this instance is not registered.
      See Also:
    • getKeyOrNull

      @Nullable NamespacedKey getKeyOrNull()
      Gets the key of this instance if it is registered otherwise returns null.
      Returns:
      the key with which this instance is registered or null if not registered.
      See Also:
    • isRegistered

      boolean isRegistered()
      Returns whether this instance is register in a registry and therefore has a key or not.
      Returns:
      true, if this instance is registered. Otherwise, false.
      See Also: