classinternalSource
public class Chunk

Constructors

public Chunk(NbtCompound root)
Wraps a chunk's NBT as it comes out of a region file
Parameters
rootNbtCompound
Throws
IllegalArgumentExceptionIf a section's palette and data don't add up

Methods

public BlockStateFormat blockStateFormat()
Returns
BlockStateFormatHow this chunk's palettes store blocks
public int chunkX()
Returns
int
public int chunkZ()
Returns
int
public ChunkSection createSection(int sectionY, String biome)
Creates a new, empty (air) section at the given Y.
Parameters
sectionYint
biomeStringThe biome to fill the new section with. If null, it looks at the section(s) directly above/below within this chunk, if both exist, their predominant biomes (calculated via ChunkSection.predominantBiome are tallied together and the overall most common one gets used; if only one exists, its predominant biome is used. If neither immediate neighbor exists, this searches outward for the nearest existing section in either direction. If this chunk has no sections at all yet, it falls back to "minecraft:plains".
Returns
ChunkSection
Throws
IllegalStateExceptionIf a section already exists at this Y
public Set<Integer> editedSections()
Returns
Set<Integer>The Y of every section setBlock changed something in
public BlockState getBlock(int x, int y, int z)
Parameters
xint
yint
zint
Returns
BlockState
public NbtCompound raw()
public void setBlock(int x, int y, int z, BlockState state)
Sets a block and automatically creates the target section (as air, with a resolved biome) if it doesn't exist yet Light and heightmaps get thrown out, Minecraft redoes them on load. A chest that turns into stone takes its items with it, a chest you place gets no block entity though, the game makes one once it needs it
Parameters
xint
yint
zint
stateBlockState

Used by

Methods of other types that accept or return Chunk.