Package net.minecraft.world.level.chunk
Class DataLayer
java.lang.Object
net.minecraft.world.level.chunk.DataLayer
A representation of a 16x16x16 cube of nibbles (half-bytes).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
private int
static final int
static final int
private static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()
void
fill
(int defaultValue) private int
get
(int index) int
get
(int x, int y, int z) Note all coordinates must be in the range [0, 16), they are not checked, and will either silently overrun the array or throw an exception.private static int
getByteIndex
(int index) byte[]
getData()
private static int
getIndex
(int x, int y, int z) private static int
getNibbleIndex
(int index) boolean
isDefinitelyFilledWith
(int value) boolean
boolean
isEmpty()
layerToString
(int unused) private static byte
packFilled
(int value) private void
set
(int index, int value) void
set
(int x, int y, int z, int value) Sets the value of this data layer at the provided position.toString()
-
Field Details
-
LAYER_COUNT
public static final int LAYER_COUNT- See Also:
-
LAYER_SIZE
public static final int LAYER_SIZE- See Also:
-
SIZE
public static final int SIZE- See Also:
-
NIBBLE_SIZE
private static final int NIBBLE_SIZE- See Also:
-
data
@Nullable protected byte[] data -
defaultValue
private int defaultValue
-
-
Constructor Details
-
DataLayer
public DataLayer() -
DataLayer
public DataLayer(int size) -
DataLayer
public DataLayer(byte[] data)
-
-
Method Details
-
get
public int get(int x, int y, int z) Note all coordinates must be in the range [0, 16), they are not checked, and will either silently overrun the array or throw an exception.- Returns:
- The value of this data layer at the provided position.
-
set
public void set(int x, int y, int z, int value) Sets the value of this data layer at the provided position. Note all coordinates must be in the range [0, 16), they are not checked, and will either silently overrun the array or throw an exception. -
getIndex
private static int getIndex(int x, int y, int z) -
get
private int get(int index) -
set
private void set(int index, int value) -
getNibbleIndex
private static int getNibbleIndex(int index) -
getByteIndex
private static int getByteIndex(int index) -
fill
public void fill(int defaultValue) -
packFilled
private static byte packFilled(int value) -
getData
public byte[] getData() -
copy
-
toString
-
layerToString
-
isDefinitelyHomogenous
public boolean isDefinitelyHomogenous() -
isDefinitelyFilledWith
public boolean isDefinitelyFilledWith(int value) -
isEmpty
public boolean isEmpty()
-