public class TerrainChunk
- Object
- TerrainChunk
A
#SIZEx#SIZE square block of terrain – the unit of streaming. Identified by its chunk
coordinates (#getChunkX(), #getChunkZ()), it is self-describing: a height per cell, a
material per cell (stored compactly as an index into the chunk’s own material palette), and
the TerrainFeatures anchored within it. StreamingTerrain loads/saves chunks on demand so
a world can be arbitrarily large without holding it all in memory.Fields
public static final int SIZE = 16 | Cells per side of a chunk. |
Constructors
public TerrainChunk(int cx, int cz) |
Methods
public int getChunkX() | |
public int getChunkZ() | |
public boolean isDirty() | Whether the chunk has unsaved edits (used by providers to decide what to persist). |
public void clearDirty() | |
public float getHeight(int localX, int localZ) | |
public void setHeight(int localX, int localZ, float h) | |
public boolean hasGround(int localX, int localZ) | |
public String getMaterial(int localX, int localZ) | |
public void setMaterial(int localX, int localZ, String materialId) | |
public List<TerrainFeature> features() | Features anchored in this chunk (mutate directly; mark dirty via #touch()). |
public void touch() |
Inherited methods
Field details
SIZE
public static final int SIZE = 16Cells per side of a chunk.
Constructor details
TerrainChunk
public TerrainChunk(int cx, int cz)Method details
getChunkX
public int getChunkX()getChunkZ
public int getChunkZ()isDirty
public boolean isDirty()Whether the chunk has unsaved edits (used by providers to decide what to persist).
clearDirty
public void clearDirty()getHeight
public float getHeight(int localX, int localZ)setHeight
public void setHeight(int localX, int localZ, float h)hasGround
public boolean hasGround(int localX, int localZ)getMaterial
public String getMaterial(int localX, int localZ)setMaterial
public void setMaterial(int localX, int localZ, String materialId)features
public List<TerrainFeature> features()Features anchored in this chunk (mutate directly; mark dirty via
#touch()).touch
public void touch()