Class IntArrayMappings

java.lang.Object
com.viaversion.viaversion.api.data.IntArrayMappings
All Implemented Interfaces:
Mappings

public class IntArrayMappings extends Object implements Mappings
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    IntArrayMappings(int[] mappings, int mappedIds)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getNewId(int id)
    Returns the mapped id from the given id, or -1 if invalid/out of bounds.
    Mappings with keys and values swapped.
    int
    Returns the amount of new ids total, even if it does not have a direct mapping.
    of(int[] mappings, int mappedIds)
     
    int[]
    raw()
     
    void
    setNewId(int id, int mappedId)
    Manually maps a specific id.
    int
    Returns amount of unmapped entries, being the size of the mapping.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.viaversion.viaversion.api.data.Mappings

    contains, getNewIdOrDefault
  • Constructor Details

    • IntArrayMappings

      protected IntArrayMappings(int[] mappings, int mappedIds)
  • Method Details

    • of

      public static IntArrayMappings of(int[] mappings, int mappedIds)
    • 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
    • inverse

      public Mappings inverse()
      Description copied from interface: Mappings
      Mappings with keys and values swapped.
      Specified by:
      inverse in interface Mappings
      Returns:
      mappings with keys and values swapped
    • raw

      public int[] raw()