Interface WritableRegistry<T extends net.kyori.adventure.key.Keyed>


@NonExtendable public interface WritableRegistry<T extends net.kyori.adventure.key.Keyed>
Registration-time handle on a static registry. Entries are attributed to the addon whose RegistrationContext provided this handle.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    alias(@NotNull net.kyori.adventure.key.Key from, @NotNull net.kyori.adventure.key.Key to)
    Makes the old key from mean the entry to, for an entry that was renamed or moved to another addon.
    boolean
    contains(@NotNull net.kyori.adventure.key.Key id)
     
    <V extends T>
    V
    register(V value)
    Registers value under its Keyed.key().
    @NotNull RegistryType<T>
     
  • Method Details

    • type

      @NotNull @NotNull RegistryType<T> type()
    • register

      @NotNull <V extends T> V register(@NotNull V value)
      Registers value under its Keyed.key().
      Returns:
      value
      Throws:
      RegistrationException - if the key is taken or the registry is frozen
    • contains

      boolean contains(@NotNull @NotNull net.kyori.adventure.key.Key id)
    • alias

      void alias(@NotNull @NotNull net.kyori.adventure.key.Key from, @NotNull @NotNull net.kyori.adventure.key.Key to)
      Makes the old key from mean the entry to, for an entry that was renamed or moved to another addon. Everything that looks entries up by key follows it: saved machine data, YAML definitions, recipes and tags. Data is saved again under to.

      Startup validation fails the alias's addon if to is not an entry of this registry (aliases do not chain) or if from is in a namespace reserved for MachineEngine.

      Throws:
      RegistrationException - if from already is an entry or an alias, or the registry is frozen
      IllegalArgumentException - if from equals to