Class PackedIntegerArray

java.lang.Object
net.minecraft.util.collection.PackedIntegerArray
All Implemented Interfaces:
PaletteStorage

public class PackedIntegerArray extends Object implements PaletteStorage
Mappings:
Namespace Name
official aiv
intermediary net/minecraft/class_3508
named net/minecraft/util/collection/PackedIntegerArray
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final long[]
     
    private final int
     
    private final int
     
    private static final int[]
    Magic constants for faster integer division by a constant.
    private final int
     
    private final int
     
    private final int
     
    private final long
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PackedIntegerArray(int elementBits, int size)
     
    PackedIntegerArray(int elementBits, int size, @org.jetbrains.annotations.Nullable long[] data)
     
    PackedIntegerArray(int elementBits, int size, IntStream values)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Executes an action on all values in this storage, sequentially.
    int
    get(int index)
    Returns the value at index in this storage.
    long[]
    Returns the backing data of this storage.
    int
    Returns the number of bits each element in this storage uses.
    int
    Returns the size of, or the number of elements in, this storage.
    private int
    getStorageIndex(int index)
     
    void
    set(int index, int value)
    Sets value to index in this storage.
    int
    swap(int index, int value)
    Sets value to index and returns the previous value in this storage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INDEX_PARAMETERS

      private static final int[] INDEX_PARAMETERS
      Magic constants for faster integer division by a constant.

      This is computed as (n * scale + offset) >> (32 + shift). For a divisor n, the constants are stored as such:

      • scale at 3 * (n - 1)
      • offset at 3 * (n - 1) + 1
      • shift at 3 * (n - 1) + 2
      Mappings:
      Namespace Name Mixin selector
      official a Laiv;a:[I
      intermediary field_24078 Lnet/minecraft/class_3508;field_24078:[I
      named INDEX_PARAMETERS Lnet/minecraft/util/collection/PackedIntegerArray;INDEX_PARAMETERS:[I
    • data

      private final long[] data
      Mappings:
      Namespace Name Mixin selector
      official b Laiv;b:[J
      intermediary field_15631 Lnet/minecraft/class_3508;field_15631:[J
      named data Lnet/minecraft/util/collection/PackedIntegerArray;data:[J
    • elementBits

      private final int elementBits
      Mappings:
      Namespace Name Mixin selector
      official c Laiv;c:I
      intermediary field_15633 Lnet/minecraft/class_3508;field_15633:I
      named elementBits Lnet/minecraft/util/collection/PackedIntegerArray;elementBits:I
    • maxValue

      private final long maxValue
      Mappings:
      Namespace Name Mixin selector
      official d Laiv;d:J
      intermediary field_15634 Lnet/minecraft/class_3508;field_15634:J
      named maxValue Lnet/minecraft/util/collection/PackedIntegerArray;maxValue:J
    • size

      private final int size
      Mappings:
      Namespace Name Mixin selector
      official e Laiv;e:I
      intermediary field_15632 Lnet/minecraft/class_3508;field_15632:I
      named size Lnet/minecraft/util/collection/PackedIntegerArray;size:I
    • elementsPerLong

      private final int elementsPerLong
      Mappings:
      Namespace Name Mixin selector
      official f Laiv;f:I
      intermediary field_24079 Lnet/minecraft/class_3508;field_24079:I
      named elementsPerLong Lnet/minecraft/util/collection/PackedIntegerArray;elementsPerLong:I
    • indexScale

      private final int indexScale
      Mappings:
      Namespace Name Mixin selector
      official g Laiv;g:I
      intermediary field_24080 Lnet/minecraft/class_3508;field_24080:I
      named indexScale Lnet/minecraft/util/collection/PackedIntegerArray;indexScale:I
    • indexOffset

      private final int indexOffset
      Mappings:
      Namespace Name Mixin selector
      official h Laiv;h:I
      intermediary field_24081 Lnet/minecraft/class_3508;field_24081:I
      named indexOffset Lnet/minecraft/util/collection/PackedIntegerArray;indexOffset:I
    • indexShift

      private final int indexShift
      Mappings:
      Namespace Name Mixin selector
      official i Laiv;i:I
      intermediary field_24082 Lnet/minecraft/class_3508;field_24082:I
      named indexShift Lnet/minecraft/util/collection/PackedIntegerArray;indexShift:I
  • Constructor Details

    • PackedIntegerArray

      public PackedIntegerArray(int elementBits, int size, IntStream values)
      Mappings:
      Namespace Name Mixin selector
      official <init> Laiv;<init>(IILjava/util/stream/IntStream;)V
      intermediary <init> Lnet/minecraft/class_3508;<init>(IILjava/util/stream/IntStream;)V
      named <init> Lnet/minecraft/util/collection/PackedIntegerArray;<init>(IILjava/util/stream/IntStream;)V
    • PackedIntegerArray

      public PackedIntegerArray(int elementBits, int size)
      Mappings:
      Namespace Name Mixin selector
      official <init> Laiv;<init>(II)V
      intermediary <init> Lnet/minecraft/class_3508;<init>(II)V
      named <init> Lnet/minecraft/util/collection/PackedIntegerArray;<init>(II)V
    • PackedIntegerArray

      public PackedIntegerArray(int elementBits, int size, @Nullable @org.jetbrains.annotations.Nullable long[] data)
      Mappings:
      Namespace Name Mixin selector
      official <init> Laiv;<init>(II[J)V
      intermediary <init> Lnet/minecraft/class_3508;<init>(II[J)V
      named <init> Lnet/minecraft/util/collection/PackedIntegerArray;<init>(II[J)V
  • Method Details

    • getStorageIndex

      private int getStorageIndex(int index)
      Mappings:
      Namespace Name Mixin selector
      official b Laiv;b(I)I
      intermediary method_27284 Lnet/minecraft/class_3508;method_27284(I)I
      named getStorageIndex Lnet/minecraft/util/collection/PackedIntegerArray;getStorageIndex(I)I
    • swap

      public int swap(int index, int value)
      Sets value to index and returns the previous value in this storage.
      Specified by:
      swap in interface PaletteStorage
      Parameters:
      index - the index
      value - the value to set
      Returns:
      the previous value
      Mappings:
      Namespace Name Mixin selector
      official a Lahr;a(II)I
      intermediary method_15214 Lnet/minecraft/class_6490;method_15214(II)I
      named swap Lnet/minecraft/util/collection/PaletteStorage;swap(II)I
    • set

      public void set(int index, int value)
      Sets value to index in this storage.
      Specified by:
      set in interface PaletteStorage
      Parameters:
      index - the index
      value - the value to set
      Mappings:
      Namespace Name Mixin selector
      official b Lahr;b(II)V
      intermediary method_15210 Lnet/minecraft/class_6490;method_15210(II)V
      named set Lnet/minecraft/util/collection/PaletteStorage;set(II)V
    • get

      public int get(int index)
      Returns the value at index in this storage.
      Specified by:
      get in interface PaletteStorage
      Parameters:
      index - the index
      Returns:
      the value at index in this storage
      Mappings:
      Namespace Name Mixin selector
      official a Lahr;a(I)I
      intermediary method_15211 Lnet/minecraft/class_6490;method_15211(I)I
      named get Lnet/minecraft/util/collection/PaletteStorage;get(I)I
    • getData

      public long[] getData()
      Returns the backing data of this storage.
      Specified by:
      getData in interface PaletteStorage
      Returns:
      the backing data of this storage
      Mappings:
      Namespace Name Mixin selector
      official a Lahr;a()[J
      intermediary method_15212 Lnet/minecraft/class_6490;method_15212()[J
      named getData Lnet/minecraft/util/collection/PaletteStorage;getData()[J
    • getSize

      public int getSize()
      Returns the size of, or the number of elements in, this storage.
      Specified by:
      getSize in interface PaletteStorage
      Returns:
      the size of, or the number of elements in, this storage
      Mappings:
      Namespace Name Mixin selector
      official b Lahr;b()I
      intermediary method_15215 Lnet/minecraft/class_6490;method_15215()I
      named getSize Lnet/minecraft/util/collection/PaletteStorage;getSize()I
    • getElementBits

      public int getElementBits()
      Returns the number of bits each element in this storage uses.
      Specified by:
      getElementBits in interface PaletteStorage
      Returns:
      the number of bits each element in this storage uses
      Mappings:
      Namespace Name Mixin selector
      official c Lahr;c()I
      intermediary method_34896 Lnet/minecraft/class_6490;method_34896()I
      named getElementBits Lnet/minecraft/util/collection/PaletteStorage;getElementBits()I
    • forEach

      public void forEach(IntConsumer action)
      Executes an action on all values in this storage, sequentially.
      Specified by:
      forEach in interface PaletteStorage
      Mappings:
      Namespace Name Mixin selector
      official a Lahr;a(Ljava/util/function/IntConsumer;)V
      intermediary method_21739 Lnet/minecraft/class_6490;method_21739(Ljava/util/function/IntConsumer;)V
      named forEach Lnet/minecraft/util/collection/PaletteStorage;forEach(Ljava/util/function/IntConsumer;)V