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 Summary
FieldsModifier and TypeFieldDescriptionprotected final RegistrationContextContext that is shared by all registry adapters owned by the same namespace.protected final BiConsumer<net.minecraft.resources.Identifier, Supplier<V>> A function that accepts and registers a key and value supplier. -
Constructor Summary
ConstructorsConstructorDescriptionGenericRegistryAdapter(RegistrationContext context, BiConsumer<net.minecraft.resources.Identifier, Supplier<V>> registryFunc) -
Method Summary
Modifier and TypeMethodDescriptionRegistryReference<net.minecraft.resources.Identifier, V> Adds a value to the registry.RegistryReference<net.minecraft.resources.Identifier, V> Adds a value to the registry.RegistryReference<net.minecraft.resources.Identifier, V> Adds a value to the registry.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RegistryAdapter
add
-
Field Details
-
context
Context that is shared by all registry adapters owned by the same namespace. -
registryFunc
A function that accepts and registers a key and value supplier.
-
-
Constructor Details
-
GenericRegistryAdapter
public GenericRegistryAdapter(RegistrationContext context, BiConsumer<net.minecraft.resources.Identifier, Supplier<V>> registryFunc)
-
-
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
Description copied from interface:RegistryAdapterAdds a value to the registry. Values are not necessarily registered immediately.- Specified by:
addin interfaceRegistryAdapter<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.
-