Class FullMappingsBase

java.lang.Object
com.viaversion.viaversion.api.data.FullMappingsBase
All Implemented Interfaces:
BiMappings, FullMappings, Mappings
Direct Known Subclasses:
FullIdentityMappings, LegacyFullStringMappingsBase, ParticleMappings

public class FullMappingsBase extends Object implements FullMappings
  • Field Details

    • stringToId

      protected final it.unimi.dsi.fastutil.objects.Object2IntMap<String> stringToId
    • mappedStringToId

      protected final it.unimi.dsi.fastutil.objects.Object2IntMap<String> mappedStringToId
    • idToKey

      protected final Key[] idToKey
    • mappedIdToKey

      protected final Key[] mappedIdToKey
    • mappings

      protected final Mappings mappings
  • Constructor Details

    • FullMappingsBase

      public FullMappingsBase(MappingDataLoader.IdentifiersPair identifiersPair, Mappings mappings)
    • FullMappingsBase

      protected FullMappingsBase(it.unimi.dsi.fastutil.objects.Object2IntMap<String> stringToId, it.unimi.dsi.fastutil.objects.Object2IntMap<String> mappedStringToId, Key[] idToKey, Key[] mappedIdToKey, Mappings mappings)
  • Method Details

    • of

      public static FullMappings of(MappingDataLoader.IdentifiersPair identifiersPair, Mappings mappings)
    • id

      public int id(String identifier)
      Description copied from interface: FullMappings
      Returns the unmapped integer id for the given identifier, or -1 if not found.
      Specified by:
      id in interface FullMappings
      Parameters:
      identifier - unmapped string identifier
      Returns:
      unmapped int id, or -1 if not found
    • mappedId

      public int mappedId(String mappedIdentifier)
      Description copied from interface: FullMappings
      Returns the mapped integer id for the given mapped identifier, or -1 if not found.
      Specified by:
      mappedId in interface FullMappings
      Parameters:
      mappedIdentifier - mapped string identifier
      Returns:
      mapped int id, or -1 if not found
    • keyFromId

      public @Nullable Key keyFromId(int id)
      Description copied from interface: FullMappings
      Returns the unmapped key for the given mapped id.
      Specified by:
      keyFromId in interface FullMappings
      Parameters:
      id - unmapped id
      Returns:
      unmapped key, or null if out of bounds
    • keyFromMappedKey

      public @Nullable Key keyFromMappedKey(String mappedIdentifier)
      Description copied from interface: FullMappings
      Returns the unmapped key for the given mapped identifier.
      Specified by:
      keyFromMappedKey in interface FullMappings
      Parameters:
      mappedIdentifier - mapped identifier
      Returns:
      unmapped key, or null if not found
    • mappedKeyFromMappedId

      public @Nullable Key mappedKeyFromMappedId(int mappedId)
      Description copied from interface: FullMappings
      Returns the mapped key for the given mapped id.
      Specified by:
      mappedKeyFromMappedId in interface FullMappings
      Parameters:
      mappedId - mapped id
      Returns:
      mapped key, or null if out of bounds
    • mappedKeyFromKey

      public @Nullable Key mappedKeyFromKey(String identifier)
      Description copied from interface: FullMappings
      Returns the mapped key for the given unmapped identifier.
      Specified by:
      mappedKeyFromKey in interface FullMappings
      Parameters:
      identifier - unmapped identifier
      Returns:
      mapped key, or null if not found
    • getNewId

      public int getNewId(int id)
      Description copied from interface: Mappings
      Returns the mapped id from the given id, or -1 if invalid/out of bounds.
      Specified by:
      getNewId in interface Mappings
      Parameters:
      id - unmapped id
      Returns:
      mapped id, or -1 if invalid/out of bounds
    • setNewId

      public void setNewId(int id, int mappedId)
      Description copied from interface: Mappings
      Manually maps a specific id.
      Specified by:
      setNewId in interface Mappings
      Parameters:
      id - unmapped id
      mappedId - mapped id
    • size

      public int size()
      Description copied from interface: Mappings
      Returns amount of unmapped entries, being the size of the mapping.
      Specified by:
      size in interface Mappings
      Returns:
      amount of unmapped entries
    • mappedSize

      public int mappedSize()
      Description copied from interface: Mappings
      Returns the amount of new ids total, even if it does not have a direct mapping. Returns -1 if unknown.
      Specified by:
      mappedSize in interface Mappings
      Returns:
      amount of new ids, or -1 if unknown
    • isIntIdIdentity

      public boolean isIntIdIdentity()
      Description copied from interface: FullMappings
      Returns whether the int id mappings are identity mappings.
      Specified by:
      isIntIdIdentity in interface FullMappings
      Returns:
      whether the int id mappings are identity mappings
      See Also:
    • inverse

      public FullMappings inverse()
      Description copied from interface: BiMappings
      Returns the inverse of the bimappings.
      Specified by:
      inverse in interface BiMappings
      Specified by:
      inverse in interface FullMappings
      Specified by:
      inverse in interface Mappings
      Returns:
      inverse of the bimappings