Package org.geysermc.geyser.registry
Class AbstractMappedDeferredRegistry<K,V,M extends Map<K,V>,R extends AbstractMappedRegistry<K,V,M>>
java.lang.Object
org.geysermc.geyser.registry.AbstractMappedDeferredRegistry<K,V,M,R>
- Direct Known Subclasses:
SimpleMappedDeferredRegistry,VersionedDeferredRegistry
public abstract class AbstractMappedDeferredRegistry<K,V,M extends Map<K,V>,R extends AbstractMappedRegistry<K,V,M>>
extends Object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMappedDeferredRegistry(I input, org.geysermc.geyser.registry.DeferredRegistry.RegistryInitializer<M, R> registryInitializer, Supplier<RegistryLoader<I, M>> deferredLoader) protectedAbstractMappedDeferredRegistry(I input, org.geysermc.geyser.registry.DeferredRegistry.RegistryInitializer<M, R> registryInitializer, RegistryLoader<I, M> deferredLoader) protectedAbstractMappedDeferredRegistry(Function<RegistryLoader<I, M>, R> registryLoader, Supplier<RegistryLoader<I, M>> deferredLoader) protectedAbstractMappedDeferredRegistry(Function<RegistryLoader<I, M>, R> registryLoader, RegistryLoader<I, M> deferredLoader) -
Method Summary
Modifier and TypeMethodDescriptionprotected Rget()Gets the underlying value held by this registry.@Nullable VReturns the value registered by the given key.getOrDefault(K key, V defaultValue) Returns the value registered by the given key or the default value specified if null.voidload()Loads the registry.booleanloaded()Whether this registry was loaded.<U> Optional<U>Returns and maps the value by the given key if present.voidRegisters what is specified in the givenConsumerinto the underlying value.Registers a new value into this registry with the given key.void
-
Constructor Details
-
AbstractMappedDeferredRegistry
protected AbstractMappedDeferredRegistry(Function<RegistryLoader<I, M>, R> registryLoader, RegistryLoader<I, M> deferredLoader) -
AbstractMappedDeferredRegistry
protected AbstractMappedDeferredRegistry(Function<RegistryLoader<I, M>, R> registryLoader, Supplier<RegistryLoader<I, M>> deferredLoader) -
AbstractMappedDeferredRegistry
protected AbstractMappedDeferredRegistry(I input, org.geysermc.geyser.registry.DeferredRegistry.RegistryInitializer<M, R> registryInitializer, RegistryLoader<I, M> deferredLoader) -
AbstractMappedDeferredRegistry
protected AbstractMappedDeferredRegistry(I input, org.geysermc.geyser.registry.DeferredRegistry.RegistryInitializer<M, R> registryInitializer, Supplier<RegistryLoader<I, M>> deferredLoader)
-
-
Method Details
-
get
Returns the value registered by the given key.- Parameters:
key- the key- Returns:
- the value registered by the given key.
-
map
Returns and maps the value by the given key if present.- Type Parameters:
U- the type- Parameters:
key- the keymapper- the mapper- Returns:
- the mapped value from the given key if present
-
getOrDefault
Returns the value registered by the given key or the default value specified if null.- Parameters:
key- the keydefaultValue- the default value- Returns:
- the value registered by the given key or the default value specified if null.
-
register
Registers a new value into this registry with the given key.- Parameters:
key- the keyvalue- the value- Returns:
- a new value into this registry with the given key.
-
backingRegistry
-
get
Gets the underlying value held by this registry.- Returns:
- the underlying value held by this registry
- Throws:
IllegalStateException- if this deferred registry has not been loaded yet
-
set
-
register
Registers what is specified in the givenConsumerinto the underlying value.- Parameters:
consumer- the consumer- Throws:
IllegalStateException- if this deferred registry has not been loaded yet
-
load
public void load()Loads the registry. -
loaded
public boolean loaded()Whether this registry was loaded.
-