Interface WritableRegistry<T,B extends RegistryBuilder<T>>

Type Parameters:
T - registry entry type
B - registry entry builder type

@Experimental @NullMarked @NonExtendable public interface WritableRegistry<T,B extends RegistryBuilder<T>>
A registry which supports registering new objects.
  • Method Details

    • register

      default void register(TypedKey<T> key, Consumer<? super B> value)
      Register a new value with the specified key. This will fire a RegistryEntryAddEvent for the new entry.
      Parameters:
      key - the entry's key (must be unique from others)
      value - a consumer for the entry's builder
    • registerWith

      void registerWith(TypedKey<T> key, Consumer<RegistryBuilderFactory<T,B>> value)
      Register a new value with the specified key. This will fire a RegistryEntryAddEvent for the new entry. The RegistryBuilderFactory lets you pre-fill a builder with an already-existing entry's properties.
      Parameters:
      key - the entry's key (must be unique from others)
      value - a consumer of a builder factory