Class NibbleArray
java.lang.Object
com.viaversion.viaversion.api.minecraft.chunks.NibbleArray
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the actual number of bytesvoid
fill
(byte value) Fill the array with a valuebyte
get
(int index) Get the value at an indexbyte
get
(int x, int y, int z) Get the value at a desired X, Y, Zbyte[]
Get the byte array behind this nibblevoid
set
(int index, int value) Set a value at an indexvoid
set
(int x, int y, int z, int value) Set the value based on an x, y, zvoid
setHandle
(byte[] handle) Copy a byte array into this nibbleint
size()
The size of this nibble
-
Constructor Details
-
NibbleArray
public NibbleArray(int length) -
NibbleArray
public NibbleArray(byte[] handle)
-
-
Method Details
-
get
public byte get(int x, int y, int z) Get the value at a desired X, Y, Z- Parameters:
x
- Block Xy
- Block Yz
- Block Z- Returns:
- The value at the given XYZ
-
get
public byte get(int index) Get the value at an index- Parameters:
index
- The index to lookup- Returns:
- The value at that index.
-
set
public void set(int x, int y, int z, int value) Set the value based on an x, y, z- Parameters:
x
- Block Xy
- Block Yz
- Block Zvalue
- Desired Value
-
set
public void set(int index, int value) Set a value at an index- Parameters:
index
- The index to set the value at.value
- The desired value
-
size
public int size()The size of this nibble- Returns:
- The size as an int of the nibble
-
actualSize
public int actualSize()Get the actual number of bytes- Returns:
- The number of bytes based on the handle.
-
fill
public void fill(byte value) Fill the array with a value- Parameters:
value
- Value to fill with
-
getHandle
public byte[] getHandle()Get the byte array behind this nibble- Returns:
- The byte array
-
setHandle
public void setHandle(byte[] handle) Copy a byte array into this nibble- Parameters:
handle
- The byte array to copy in.
-