Class GameRegistryAdapter<V>
java.lang.Object
net.darkhax.bookshelf.common.api.registry.adapters.GameRegistryAdapter<V>
- Type Parameters:
V- The type of value held by the registry.
- All Implemented Interfaces:
RegistryAdapter<net.minecraft.resources.ResourceKey<V>, V>
- Direct Known Subclasses:
BlockRegistryAdapter, CreativeModeTabAdapter, PotPatternAdapter, RecipeTypeAdapter, SoundEventAdapter
public class GameRegistryAdapter<V>
extends Object
implements RegistryAdapter<net.minecraft.resources.ResourceKey<V>, V>
A basic registry adapter that can register into most vanilla style 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.ResourceKey<V>, Supplier<V>> A function that accepts and registers a key and value supplier.protected final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<V>> The id of the registry being adapted. -
Constructor Summary
ConstructorsConstructorDescriptionGameRegistryAdapter(RegistrationContext context, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<V>> registryKey, BiConsumer<net.minecraft.resources.ResourceKey<V>, Supplier<V>> registryFunc) -
Method Summary
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. -
registryKey
The id of the registry being adapted. -
registryFunc
A function that accepts and registers a key and value supplier.
-
-
Constructor Details
-
GameRegistryAdapter
public GameRegistryAdapter(RegistrationContext context, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<V>> registryKey, BiConsumer<net.minecraft.resources.ResourceKey<V>, Supplier<V>> registryFunc)
-
-
Method Details
-
add
public RegistryReference<net.minecraft.resources.ResourceKey<V>, V> add(String key, Supplier<V> value) Description copied from interface:RegistryAdapterAdds a value to the registry. Values are not necessarily registered immediately.- Specified by:
addin interfaceRegistryAdapter<net.minecraft.resources.ResourceKey<V>, 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.
-
id
Creates a new Identifier using the current namespace.- Parameters:
key- The path of the Identifier.- Returns:
- A new Identifier with the current namespace.
-