public class ChunkSection extends Object
Modifier and Type | Field and Description |
---|---|
static int |
LIGHT_LENGTH
Length of the sky and block light nibble arrays.
|
static int |
SIZE
Size (dimensions) of blocks in a chunks section.
|
Constructor and Description |
---|
ChunkSection() |
ChunkSection(int expectedPaletteLength) |
Modifier and Type | Method and Description |
---|---|
void |
addPaletteEntry(int id) |
void |
clearPalette() |
int |
getBlockData(int x,
int y,
int z) |
int |
getBlockId(int x,
int y,
int z) |
@Nullable byte[] |
getBlockLight() |
@Nullable NibbleArray |
getBlockLightNibbleArray() |
int |
getFlatBlock(int idx) |
int |
getFlatBlock(int x,
int y,
int z) |
int |
getNonAirBlocksCount() |
int |
getPaletteEntry(int index) |
int |
getPaletteIndex(int idx) |
int |
getPaletteSize() |
@Nullable byte[] |
getSkyLight() |
@Nullable NibbleArray |
getSkyLightNibbleArray() |
boolean |
hasBlockLight() |
boolean |
hasSkyLight()
Check if sky light is present
|
static int |
index(int x,
int y,
int z) |
void |
readBlockLight(io.netty.buffer.ByteBuf input) |
void |
readSkyLight(io.netty.buffer.ByteBuf input) |
void |
replacePaletteEntry(int oldId,
int newId) |
void |
setBlock(int idx,
int type,
int data) |
void |
setBlock(int x,
int y,
int z,
int type,
int data)
Set a block in the chunks
This method will not update non-air blocks count
|
void |
setBlockLight(@Nullable byte[] data)
Set the block light array
|
void |
setFlatBlock(int idx,
int id)
Set a block state in the chunk
This method will not update non-air blocks count
|
void |
setFlatBlock(int x,
int y,
int z,
int type) |
void |
setNonAirBlocksCount(int nonAirBlocksCount) |
void |
setPaletteEntry(int index,
int id) |
void |
setPaletteIndex(int idx,
int index) |
void |
setSkyLight(@Nullable byte[] data)
Set the sky light array
|
void |
writeBlockLight(io.netty.buffer.ByteBuf output)
Write the block light to a buffer
|
void |
writeSkyLight(io.netty.buffer.ByteBuf output)
Write the sky light to a buffer
|
public static final int SIZE
public static final int LIGHT_LENGTH
public ChunkSection()
public ChunkSection(int expectedPaletteLength)
public void setBlock(int x, int y, int z, int type, int data)
x
- Block Xy
- Block Yz
- Block Ztype
- The type of the blockdata
- The data value of the blockpublic void setFlatBlock(int x, int y, int z, int type)
public int getBlockId(int x, int y, int z)
public int getBlockData(int x, int y, int z)
public int getFlatBlock(int x, int y, int z)
public int getFlatBlock(int idx)
public void setBlock(int idx, int type, int data)
public void setPaletteIndex(int idx, int index)
public int getPaletteIndex(int idx)
public int getPaletteSize()
public int getPaletteEntry(int index)
public void setPaletteEntry(int index, int id)
public void replacePaletteEntry(int oldId, int newId)
public void addPaletteEntry(int id)
public void clearPalette()
public void setFlatBlock(int idx, int id)
idx
- Indexid
- The raw or flat id of the blockpublic void setBlockLight(@Nullable @Nullable byte[] data)
data
- The value to set the block light topublic void setSkyLight(@Nullable @Nullable byte[] data)
data
- The value to set the sky light to@Nullable public @Nullable byte[] getBlockLight()
@Nullable public @Nullable NibbleArray getBlockLightNibbleArray()
@Nullable public @Nullable byte[] getSkyLight()
@Nullable public @Nullable NibbleArray getSkyLightNibbleArray()
public void readBlockLight(io.netty.buffer.ByteBuf input)
public void readSkyLight(io.netty.buffer.ByteBuf input)
public static int index(int x, int y, int z)
public void writeBlockLight(io.netty.buffer.ByteBuf output)
output
- The buffer to write topublic void writeSkyLight(io.netty.buffer.ByteBuf output)
output
- The buffer to write topublic boolean hasSkyLight()
public boolean hasBlockLight()
public int getNonAirBlocksCount()
public void setNonAirBlocksCount(int nonAirBlocksCount)
Copyright © 2016–2021. All rights reserved.