public class PackedArrayCube<T>
extends java.lang.Object
long array of indexes and a linear palette.| Modifier and Type | Class and Description |
|---|---|
class |
PackedArrayCube.PackedData |
| Constructor and Description |
|---|
PackedArrayCube(int size,
int minimumWordSize,
boolean straddleLongs,
java.lang.Class<T> type)
Create an empty packed array cube of the specified size.
|
PackedArrayCube(int size,
long[] data,
T[] palette,
int minimumWordSize,
boolean straddleLongs,
java.lang.Class<T> type)
Create a packed array cube of the specified size by unpacking an existing data array and palette.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fill(T value) |
T |
getValue(int x,
int y,
int z) |
boolean |
isEmpty() |
PackedArrayCube.PackedData |
pack()
Pack the data into a palette and a
long array. |
PackedArrayCube.PackedData |
pack(T nullSubstitute)
Pack the data into a palette and a
long array. |
void |
setValue(int x,
int y,
int z,
T value) |
public PackedArrayCube(int size,
int minimumWordSize,
boolean straddleLongs,
java.lang.Class<T> type)
size - Length of one edge of the cube.minimumWordSize - The minimum word size for the packed data. In Minecraft this varies, from 4 for block
states (resulting in unnecessarily large arrays) to 1 for biomes.straddleLongs - Whether palette indexes are allowed to straddle two longs in the packed data array. It
seems that Minecraft 1.15 supports this, whereas Minecraft 1.16+ does not.type - The type of values to be stored in the packed array cube.public PackedArrayCube(int size,
long[] data,
T[] palette,
int minimumWordSize,
boolean straddleLongs,
java.lang.Class<T> type)
size - Length of one edge of the cube.data - The data array to unpack.palette - The palette of values.minimumWordSize - The minimum word size for the packed data. In Minecraft this varies, from 4 for block
states (resulting in unnecessarily large arrays) to 1 for biomes.straddleLongs - Whether palette indexes are allowed to straddle two longs in the packed data array. It
seems that Minecraft 1.15 supports this, whereas Minecraft 1.16+ does not.type - The type of values to be stored in the packed array cube.public T getValue(int x, int y, int z)
public void setValue(int x,
int y,
int z,
T value)
public void fill(T value)
public boolean isEmpty()
public PackedArrayCube.PackedData pack()
long array. null values are not replaced and if any of the
values are null, the palette will contain a null entry.public PackedArrayCube.PackedData pack(T nullSubstitute)
long array.nullSubstitute - The value to replace null values with, if any. May be null, in which case
one of the palette entries may be null.