Interface IMetaRegistry<K>

All Known Implementing Classes:
MetaRegistry

public interface IMetaRegistry<K>
  • Method Details

    • newMetaObject

      <T> T newMetaObject(MetaKey<T> key, K holder)
      Returns a new instance of the associated meta object which is created from the Supplier passed in the register method.
      Type Parameters:
      T - Type of the returned object
      Parameters:
      key - Metakey from #register(Supplier).
      Returns:
      New instance of Meta object
      Throws:
      IllegalArgumentException - Thrown if the object is not registered
    • forEachMetaEntry

      void forEachMetaEntry(IMetaStore<K> store, IMetaRegistry.MetaEntryConsumer consumer)
    • getMetaKeyForCodecKey

      @Nullable PersistentMetaKey<?> getMetaKeyForCodecKey(String codecKey)
    • registerMetaObject

      <T> MetaKey<T> registerMetaObject(Function<K,T> function, boolean persistent, String keyName, Codec<T> codec)
      This is used to create a new meta object and returns the integer id to lookup the object
      Parameters:
      function - Supplier used to create a new object when a world has no instance
      persistent - True if meta value is persistent
      keyName - Key name of this codec
      codec - Codec to encode this type. Generally a KeyedCodec
      Returns:
      MetaKey to lookup the meta object
    • registerMetaObject

      default <T> MetaKey<T> registerMetaObject(Function<K,T> supplier, String keyName, Codec<T> codec)
      This is used to create a new meta object and returns the integer id to lookup the object. It is marked as persistent on default.
      Parameters:
      supplier - Supplier used to create a new object when a world has no instance
      keyName - Key name of this codec
      codec - Codec to encode this type. Generally a KeyedCodec
      Returns:
      MetaKey to lookup the meta object
    • registerMetaObject

      default <T> MetaKey<T> registerMetaObject(Function<K,T> supplier)
      This is used to create a new meta object and returns the integer id to lookup the object. The meta value is always non-persistent
      Parameters:
      supplier - Supplier used to create a new object when a world has no instance
      Returns:
      MetaKey to lookup the meta object
    • registerMetaObject

      default <T> MetaKey<T> registerMetaObject()
      Registers meta object with a null initializer
      Type Parameters:
      T - Type of the object
      Returns:
      MetaKey to lookup the meta object