Class IdMapper<T>

java.lang.Object
net.minecraft.core.IdMapper<T>
All Implemented Interfaces:
Iterable<T>, IdMap<T>
Direct Known Subclasses:
NeoForgeRegistryCallbacks.BlockCallbacks.ClearableObjectIntIdentityMap

public class IdMapper<T> extends Object implements IdMap<T>
  • Field Details

    • nextId

      protected int nextId
    • tToId

      protected final it.unimi.dsi.fastutil.objects.Reference2IntMap<T> tToId
    • idToT

      protected final List<T> idToT
  • Constructor Details

    • IdMapper

      public IdMapper()
    • IdMapper

      public IdMapper(int pExpectedSize)
  • Method Details

    • addMapping

      public void addMapping(T pKey, int pValue)
    • add

      public void add(T pKey)
    • getId

      public int getId(T pValue)
      Specified by:
      getId in interface IdMap<T>
      Returns:
      the integer ID used to identify the given object
    • byId

      @Nullable public final T byId(int pId)
      Specified by:
      byId in interface IdMap<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • contains

      public boolean contains(int pId)
    • size

      public int size()
      Specified by:
      size in interface IdMap<T>