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 pDefaultValue) private int
get
(int pIndex) int
get
(int pX, int pY, int pZ) 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 pIndex) byte[]
getData()
private static int
getIndex
(int pX, int pY, int pZ) private static int
getNibbleIndex
(int pIndex) boolean
isDefinitelyFilledWith
(int pValue) boolean
boolean
isEmpty()
layerToString
(int pUnused) private static byte
packFilled
(int pValue) private void
set
(int pIndex, int pValue) void
set
(int pX, int pY, int pZ, int pValue) 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 pSize) -
DataLayer
public DataLayer(byte[] pData)
-
-
Method Details
-
get
public int get(int pX, int pY, int pZ) 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 pX, int pY, int pZ, int pValue) 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 pX, int pY, int pZ) -
get
private int get(int pIndex) -
set
private void set(int pIndex, int pValue) -
getNibbleIndex
private static int getNibbleIndex(int pIndex) -
getByteIndex
private static int getByteIndex(int pIndex) -
fill
public void fill(int pDefaultValue) -
packFilled
private static byte packFilled(int pValue) -
getData
public byte[] getData() -
copy
-
toString
-
layerToString
-
isDefinitelyHomogenous
public boolean isDefinitelyHomogenous() -
isDefinitelyFilledWith
public boolean isDefinitelyFilledWith(int pValue) -
isEmpty
public boolean isEmpty()
-