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.
  • Constructor Details

    • IntMappedRegistry

      protected IntMappedRegistry(I input, RegistryLoader<I,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>> registryLoader)
  • Method Details

    • get

      public V get(int i)
      Returns the value registered by the given integer.
      Parameters:
      i - the integer
      Returns:
      the value registered by the given integer.
    • get

      @Deprecated public @Nullable V get(Integer key)
      Deprecated.
      Description copied from class: AbstractMappedRegistry
      Returns the value registered by the given key.
      Overrides:
      get in class AbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>
      Parameters:
      key - the key
      Returns:
      the value registered by the given key.
    • getOrDefault

      public V getOrDefault(int i, V defaultValue)
      Returns the value registered by the given key or the default value specified if null.
      Parameters:
      i - the key
      defaultValue - the default value
      Returns:
      the value registered by the given key or the default value specified if null.
    • getOrDefault

      @Deprecated public V getOrDefault(Integer key, V defaultValue)
      Deprecated.
      Description copied from class: AbstractMappedRegistry
      Returns the value registered by the given key or the default value specified if null.
      Overrides:
      getOrDefault in class AbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>
      Parameters:
      key - the key
      defaultValue - the default value
      Returns:
      the value registered by the given key or the default value specified if null.
    • register

      public V register(int i, V value)
      Registers a new value into this registry with the given key.
      Parameters:
      i - the key
      value - the value
      Returns:
      a new value into this registry with the given key.
    • register

      @Deprecated public V register(Integer key, V value)
      Deprecated.
      Description copied from class: AbstractMappedRegistry
      Registers a new value into this registry with the given key.
      Overrides:
      register in class AbstractMappedRegistry<Integer,V,it.unimi.dsi.fastutil.ints.Int2ObjectMap<V>>
      Parameters:
      key - the key
      value - 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 given RegistryLoader. 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 input
      V - 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 given RegistryLoader and input.
      Type Parameters:
      I - the input
      V - the map value
      Parameters:
      registryLoader - the registry loader
      Returns:
      a new registry with the given RegistryLoader supplier