public interface Terrain

Known subtypesStreamingTerrain

Abstraction over a heightfield + per-cell material + placed TerrainFeatures addressed by world cell coordinates. The legacy TerrainGrid is a small fixed implementation; for large/infinite worlds use StreamingTerrain, which pages TerrainChunks in and out through a ChunkProvider. All coordinates are integer tile/cell coordinates (which may be negative for an unbounded terrain). Heights equal to #NO_GROUND mean “no floor here” (a hole/gap).

Fields

public static final float NO_GROUND = -1024.0fSentinel height meaning “no ground in this cell”.

Methods

public abstract float getHeight(int x, int z)
public abstract void setHeight(int x, int z, float height)
public abstract boolean hasGround(int x, int z)
public abstract String getMaterial(int x, int z)Material id at the cell (resolve via MaterialRegistry).
public abstract void setMaterial(int x, int z, String materialId)
public abstract List<TerrainFeature> features()Features whose anchor cell is currently loaded.
public abstract void addFeature(TerrainFeature feature)Adds a feature, routing it to the chunk that owns its position.
public abstract boolean isBounded()True for a fixed-size terrain (#getCols()/#getRows() valid), false if unbounded.
public abstract int getCols()Column count for a bounded terrain, or -1 if unbounded.
public abstract int getRows()Row count for a bounded terrain, or -1 if unbounded.

Field details

NO_GROUND

public static final float NO_GROUND = -1024.0f
Sentinel height meaning “no ground in this cell”.

Method details

getHeight

public abstract float getHeight(int x, int z)

setHeight

public abstract void setHeight(int x, int z, float height)

hasGround

public abstract boolean hasGround(int x, int z)

getMaterial

public abstract String getMaterial(int x, int z)
Material id at the cell (resolve via MaterialRegistry).

setMaterial

public abstract void setMaterial(int x, int z, String materialId)

features

public abstract List<TerrainFeature> features()
Features whose anchor cell is currently loaded.

addFeature

public abstract void addFeature(TerrainFeature feature)
Adds a feature, routing it to the chunk that owns its position.

isBounded

public abstract boolean isBounded()
True for a fixed-size terrain (#getCols()/#getRows() valid), false if unbounded.

getCols

public abstract int getCols()
Column count for a bounded terrain, or -1 if unbounded.

getRows

public abstract int getRows()
Row count for a bounded terrain, or -1 if unbounded.