Package org.geysermc.geyser.registry
Class IntMappedRegistry<V>
java.lang.Object
org.geysermc.geyser.registry.Registry<M>
org.geysermc.geyser.registry.AbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>
org.geysermc.geyser.registry.IntMappedRegistry<V>
- Type Parameters:
V- the value
public class IntMappedRegistry<V>
extends AbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>
A mapped registry with an integer as the key. This class is designed to minimize the need for boxing/unboxing keys.
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIntMappedRegistry(I input, RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>> registryLoader) -
Method Summary
Modifier and TypeMethodDescriptionstatic <I, V> IntMappedRegistry<V>create(I input, Supplier<RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>> registryLoader)Creates a new integer mapped registry with the givenRegistryLoaderand input.static <I, V> IntMappedRegistry<V>create(RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>> registryLoader)Creates a new integer mapped registry with the givenRegistryLoader.get(int i)Returns the value registered by the given integer.Deprecated.getOrDefault(int i, V defaultValue)Returns the value registered by the given key or the default value specified if null.getOrDefault(Integer key, V defaultValue)Deprecated.Registers a new value into this registry with the given key.Deprecated.Methods inherited from class org.geysermc.geyser.registry.AbstractMappedRegistry
map
-
Constructor Details
-
IntMappedRegistry
protected IntMappedRegistry(I input, RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>> registryLoader)
-
-
Method Details
-
get
Returns the value registered by the given integer.- Parameters:
i- the integer- Returns:
- the value registered by the given integer.
-
get
Deprecated.Description copied from class:AbstractMappedRegistryReturns the value registered by the given key.- Overrides:
getin classAbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>- Parameters:
key- the key- Returns:
- the value registered by the given key.
-
getOrDefault
Returns the value registered by the given key or the default value specified if null.- Parameters:
i- the keydefaultValue- the default value- Returns:
- the value registered by the given key or the default value specified if null.
-
getOrDefault
Deprecated.Description copied from class:AbstractMappedRegistryReturns the value registered by the given key or the default value specified if null.- Overrides:
getOrDefaultin classAbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>- 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:
i- the keyvalue- the value- Returns:
- a new value into this registry with the given key.
-
register
Deprecated.Description copied from class:AbstractMappedRegistryRegisters a new value into this registry with the given key.- Overrides:
registerin classAbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>- Parameters:
key- the keyvalue- the value- Returns:
- a new value into this registry with the given key.
-
create
public static <I, V> IntMappedRegistry<V> create(RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>> registryLoader)Creates a new integer mapped registry with the givenRegistryLoader. The input type is not specified here, meaning the loader return type is either predefined, or the registry is populated at a later point.- Type Parameters:
I- the inputV- the map value- Parameters:
registryLoader- the registry loader- Returns:
- a new registry with the given RegistryLoader
-
create
public static <I, V> IntMappedRegistry<V> create(I input, Supplier<RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>> registryLoader)Creates a new integer mapped registry with the givenRegistryLoaderand input.- Type Parameters:
I- the inputV- the map value- Parameters:
registryLoader- the registry loader- Returns:
- a new registry with the given RegistryLoader supplier
-