Class ChunkNibbleArray

java.lang.Object
net.minecraft.world.chunk.ChunkNibbleArray

public final class ChunkNibbleArray extends Object
A chunk nibble array is an array of nibbles for each block position in a chunk. It is most often used to store light data.

A nibble is 4 bits, storing an integer from 0 to 15. It takes half the space of a byte.

The nibbles are stored in an X-Z-Y major order; in the backing array, the indices increases by first increasing X, then Z, and finally Y.

Mappings:
Namespace Name
official cqc
intermediary net/minecraft/class_2804
named net/minecraft/world/chunk/ChunkNibbleArray
  • Field Details

    • COPY_TIMES

      public static final int COPY_TIMES
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a:I
      intermediary field_34052 Lnet/minecraft/class_2804;field_34052:I
      named COPY_TIMES Lnet/minecraft/world/chunk/ChunkNibbleArray;COPY_TIMES:I
    • COPY_BLOCK_SIZE

      public static final int COPY_BLOCK_SIZE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lcqc;b:I
      intermediary field_31404 Lnet/minecraft/class_2804;field_31404:I
      named COPY_BLOCK_SIZE Lnet/minecraft/world/chunk/ChunkNibbleArray;COPY_BLOCK_SIZE:I
    • BYTES_LENGTH

      public static final int BYTES_LENGTH
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official c Lcqc;c:I
      intermediary field_31403 Lnet/minecraft/class_2804;field_31403:I
      named BYTES_LENGTH Lnet/minecraft/world/chunk/ChunkNibbleArray;BYTES_LENGTH:I
    • NIBBLE_BITS

      private static final int NIBBLE_BITS
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official e Lcqc;e:I
      intermediary field_31405 Lnet/minecraft/class_2804;field_31405:I
      named NIBBLE_BITS Lnet/minecraft/world/chunk/ChunkNibbleArray;NIBBLE_BITS:I
    • bytes

      @Nullable protected @org.jetbrains.annotations.Nullable byte[] bytes
      Mappings:
      Namespace Name Mixin selector
      official d Lcqc;d:[B
      intermediary field_12783 Lnet/minecraft/class_2804;field_12783:[B
      named bytes Lnet/minecraft/world/chunk/ChunkNibbleArray;bytes:[B
  • Constructor Details

    • ChunkNibbleArray

      public ChunkNibbleArray()
    • ChunkNibbleArray

      public ChunkNibbleArray(byte[] bytes)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcqc;<init>([B)V
      intermediary <init> Lnet/minecraft/class_2804;<init>([B)V
      named <init> Lnet/minecraft/world/chunk/ChunkNibbleArray;<init>([B)V
    • ChunkNibbleArray

      protected ChunkNibbleArray(int size)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcqc;<init>(I)V
      intermediary <init> Lnet/minecraft/class_2804;<init>(I)V
      named <init> Lnet/minecraft/world/chunk/ChunkNibbleArray;<init>(I)V
  • Method Details

    • get

      public int get(int x, int y, int z)
      Returns the integer value of a nibble, in [0, 15].
      Returns:
      the integer value of a nibble, in [0, 15]
      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a(III)I
      intermediary method_12139 Lnet/minecraft/class_2804;method_12139(III)I
      named get Lnet/minecraft/world/chunk/ChunkNibbleArray;get(III)I
    • set

      public void set(int x, int y, int z, int value)
      Sets the value of a nibble.

      If the value has bits outside of the lowest 4 set to 1, (value is outside of [0, 15]), the extraneous bits are discarded.

      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a(IIII)V
      intermediary method_12145 Lnet/minecraft/class_2804;method_12145(IIII)V
      named set Lnet/minecraft/world/chunk/ChunkNibbleArray;set(IIII)V
    • getIndex

      private static int getIndex(int int2, int x, int y)
      Mappings:
      Namespace Name Mixin selector
      official b Lcqc;b(III)I
      intermediary method_12140 Lnet/minecraft/class_2804;method_12140(III)I
      named getIndex Lnet/minecraft/world/chunk/ChunkNibbleArray;getIndex(III)I
    • get

      private int get(int index)
      Mappings:
      Namespace Name Mixin selector
      official b Lcqc;b(I)I
      intermediary method_12141 Lnet/minecraft/class_2804;method_12141(I)I
      named get Lnet/minecraft/world/chunk/ChunkNibbleArray;get(I)I
    • set

      private void set(int index, int value)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a(II)V
      intermediary method_12142 Lnet/minecraft/class_2804;method_12142(II)V
      named set Lnet/minecraft/world/chunk/ChunkNibbleArray;set(II)V
    • occupiesSmallerBits

      private static int occupiesSmallerBits(int i)
      Returns if the nibble at n is stored in the less significant (smaller) 4 bits of the byte in the backing array.
      Returns:
      if the nibble at n is stored in the less significant (smaller) 4 bits of the byte in the backing array
      Mappings:
      Namespace Name Mixin selector
      official c Lcqc;c(I)I
      intermediary method_37459 Lnet/minecraft/class_2804;method_37459(I)I
      named occupiesSmallerBits Lnet/minecraft/world/chunk/ChunkNibbleArray;occupiesSmallerBits(I)I
    • getArrayIndex

      private static int getArrayIndex(int i)
      Mappings:
      Namespace Name Mixin selector
      official d Lcqc;d(I)I
      intermediary method_12138 Lnet/minecraft/class_2804;method_12138(I)I
      named getArrayIndex Lnet/minecraft/world/chunk/ChunkNibbleArray;getArrayIndex(I)I
    • asByteArray

      public byte[] asByteArray()
      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a()[B
      intermediary method_12137 Lnet/minecraft/class_2804;method_12137()[B
      named asByteArray Lnet/minecraft/world/chunk/ChunkNibbleArray;asByteArray()[B
    • copy

      public ChunkNibbleArray copy()
      Mappings:
      Namespace Name Mixin selector
      official b Lcqc;b()Lcqc;
      intermediary method_12144 Lnet/minecraft/class_2804;method_12144()Lnet/minecraft/class_2804;
      named copy Lnet/minecraft/world/chunk/ChunkNibbleArray;copy()Lnet/minecraft/world/chunk/ChunkNibbleArray;
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • bottomToString

      public String bottomToString(int unused)
      Returns a hexademical string representation of the y=0 level of this array.

      It is useful for debugging the grid nibble array.

      Parameters:
      unused - unused
      Returns:
      a hexademical string representation of the y=0 level of this array
      Mappings:
      Namespace Name Mixin selector
      official a Lcqc;a(I)Ljava/lang/String;
      intermediary method_35320 Lnet/minecraft/class_2804;method_35320(I)Ljava/lang/String;
      named bottomToString Lnet/minecraft/world/chunk/ChunkNibbleArray;bottomToString(I)Ljava/lang/String;
    • isUninitialized

      public boolean isUninitialized()
      Mappings:
      Namespace Name Mixin selector
      official c Lcqc;c()Z
      intermediary method_12146 Lnet/minecraft/class_2804;method_12146()Z
      named isUninitialized Lnet/minecraft/world/chunk/ChunkNibbleArray;isUninitialized()Z