API reference / @jsprismarine/prismarine / world/generators/datadriven/TerrainProtoCache
world/generators/datadriven/TerrainProtoCache
Classes
Interfaces
TerrainProtoCacheEvent
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:49
Events from an opt-in terrain proto cache, suitable for workload measurements.
Properties
bytes?
readonlyoptionalbytes?:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:53
Record size for reads and writes, or file size for an eviction.
type
readonlytype:"hit"|"miss"|"corrupt"|"write"|"skip"|"invalidate"|"evict"|"scan"
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:51
Whether the cache used, skipped, or removed a record.
TerrainProtoCacheOptions
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:57
Configuration for an opt-in disk cache of terrain-status proto chunks.
Properties
codeVersion?
readonlyoptionalcodeVersion?:string
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:68
Identifies the code that builds the tiles, such as the server version.
It becomes part of every record's key, so a build that generates different terrain never reads what an older one wrote. The records left behind age out under maxBytes.
directory
readonlydirectory:string
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:59
A dedicated directory for versioned cache records.
maxBytes
readonlymaxBytes:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:61
Maximum bytes held by cache records and temporary writes.
onEvent?
readonlyoptionalonEvent?: (event) =>void
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:76
Observe cache events without changing generation behavior. Observer errors are ignored.
Parameters
event
Returns
void
writesPerScan?
readonlyoptionalwritesPerScan?:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:74
Writes between full directory scans, 256 when left out. Each cache instance counts only its own writes between scans, so where several threads write one directory each scans more often, which bounds how far their writes together can run past maxBytes.
TerrainProtoIdentity
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:37
The chunk geometry a cached terrain tile must match before the generator can adopt it.
Properties
chunkX
readonlychunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:39
Chunk X coordinate.
chunkZ
readonlychunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:41
Chunk Z coordinate.
height
readonlyheight:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:45
Number of Y levels in the world dimension.
minY
readonlyminY:number
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:43
Lowest Y coordinate of the world dimension.
Functions
canonicalWorldgenInput()
canonicalWorldgenInput(
value):CanonicalWorldgenInput
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:453
Writes a value in canonical form once, for reuse inside many fingerprintWorldgenInput calls.
Parameters
value
unknown
Returns
fingerprintWorldgenInput()
fingerprintWorldgenInput(
value):string
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:438
Hashes JSON values and string-keyed maps in canonical key order.
Parameters
value
unknown
Returns
string
terrainProtoCacheKey()
terrainProtoCacheKey(
input):string
Defined in: packages/prismarine/src/world/generators/datadriven/TerrainProtoCache.ts:462
Creates a cache key that changes with the record schema, generator version, or status.
Parameters
input
unknown
Returns
string