Class GenericRegistryAdapter<V>

java.lang.Object
net.darkhax.bookshelf.common.api.registry.adapters.GenericRegistryAdapter<V>
Type Parameters:
V - The type of value held by the registry.
All Implemented Interfaces:
RegistryAdapter<net.minecraft.resources.Identifier, V>
Direct Known Subclasses:
CommandArgumentAdapter, IngredientTypeAdapter, MenuTypeAdapter

public class GenericRegistryAdapter<V> extends Object implements RegistryAdapter<net.minecraft.resources.Identifier, V>
A basic registry adapter that can register into registries that are not standard vanilla registries.
  • Field Details

    • context

      protected final RegistrationContext context
      Context that is shared by all registry adapters owned by the same namespace.
    • registryFunc

      protected final BiConsumer<net.minecraft.resources.Identifier, Supplier<V>> registryFunc
      A function that accepts and registers a key and value supplier.
  • Constructor Details

  • Method Details

    • add

      public RegistryReference<net.minecraft.resources.Identifier, V> add(net.minecraft.resources.Identifier id, Supplier<V> value)
      Adds a value to the registry. Values are not necessarily registered immediately.
      Parameters:
      id - The ID to register the value under.
      value - A supplier that produces the value to register.
      Returns:
      A reference to the registry entry.
    • add

      public RegistryReference<net.minecraft.resources.Identifier, V> add(net.minecraft.resources.Identifier id, V value)
      Adds a value to the registry. Values are not necessarily registered immediately.
      Parameters:
      id - The ID to register the value under.
      value - The value to register.
      Returns:
      A reference to the registry entry.
    • add

      public RegistryReference<net.minecraft.resources.Identifier, V> add(String key, Supplier<V> value)
      Description copied from interface: RegistryAdapter
      Adds a value to the registry. Values are not necessarily registered immediately.
      Specified by:
      add in interface RegistryAdapter<net.minecraft.resources.Identifier, V>
      Parameters:
      key - The ID to register the value under. This ID only needs to be unique within your namespace.
      value - A supplier that produces the value to register.
      Returns:
      A reference to the registry entry.