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 intstatic final intstatic final intprivate static final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()voidfill(int defaultValue) private intget(int index) intget(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 intgetByteIndex(int index) byte[]getData()private static intgetIndex(int x, int y, int z) private static intgetNibbleIndex(int index) booleanisDefinitelyFilledWith(int value) booleanbooleanisEmpty()layerToString(int unused) private static bytepackFilled(int value) private voidset(int index, int value) voidset(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()
-