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 pDefaultValue) private intget(int pIndex) intget(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 intgetByteIndex(int pIndex) byte[]getData()private static intgetIndex(int pX, int pY, int pZ) private static intgetNibbleIndex(int pIndex) booleanisDefinitelyFilledWith(int pValue) booleanbooleanisEmpty()layerToString(int pUnused) private static bytepackFilled(int pValue) private voidset(int pIndex, int pValue) voidset(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()
-