Skip to content

API reference / @jsprismarine/prismarine / world/generators/datadriven/javaStructureStarts / StructureStartSource

Class: StructureStartSource ​

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:262

The structure starts a world has, for one seed.

One of these covers one dimension of one world. It is built once and asked per chunk.

Constructors ​

Constructor ​

new StructureStartSource(options): StructureStartSource

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:284

Parameters ​

options ​

StructureStartOptions

Returns ​

StructureStartSource

Methods ​

candidatesForRegion() ​

candidatesForRegion(minChunkX, minChunkZ, maxChunkX, maxChunkZ): readonly StructureStartCandidate[]

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:346

Candidate starts that may be queried while generating a rectangular chunk region.

Every target chunk queries the eight-chunk reference window around it. Expanding the requested region by that radius produces the exact union, so callers can plan starts before dispatch without assembling any layout on the coordinator thread.

Parameters ​

minChunkX ​

number

Minimum target chunk x.

minChunkZ ​

number

Minimum target chunk z.

maxChunkX ​

number

Maximum target chunk x.

maxChunkZ ​

number

Maximum target chunk z.

Returns ​

readonly StructureStartCandidate[]

Candidates in the union of all target chunks' reference windows.


installPlans() ​

installPlans(entries): void

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:390

Installs worker-produced plans before a chunk task starts asking for structure references.

Parameters ​

entries ​

readonly StructureStartPlanEntry[]

Plans or rejection records returned by owner workers.

Returns ​

void


locate() ​

locate(options): StructureStart | undefined

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:430

The structure Java's /locate answers, or undefined when the search radius held none.

This is Java's ChunkGenerator.findNearestMapStructure. It is not always the nearest start: a random spread placement is walked one ring of regions at a time, each ring answers the first start in scan order, and the first ring with an answer ends the search. A start in the next ring can be nearer than the one answered, and Java answers the same.

Each region offers one candidate chunk, so the command's hundred rings ask about forty thousand positions rather than the millions of chunks they cover, and only a candidate the walk reaches is laid out. Nothing here touches a chunk, so this costs no terrain and writes nothing.

Parameters ​

options ​

StructureSearchOptions

Where to search from, how far, and which structures count.

Returns ​

StructureStart | undefined

The start, or undefined when nothing matched inside the radius.

Java Source ​

ChunkGenerator.findNearestMapStructure


plansForCandidates() ​

plansForCandidates(candidates): readonly StructureStartPlanEntry[]

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:372

Builds the requested starts and returns their cloneable plans, caching positive and negative results.

Parameters ​

candidates ​

readonly StructureStartCandidate[]

Candidate starts assigned to this worker.

Returns ​

readonly StructureStartPlanEntry[]

One plan or rejection record for each candidate.


startAt() ​

startAt(named, chunkX, chunkZ): StructureStart | null

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:623

The start a set produces in one chunk, laid out once and kept.

Parameters ​

named ​

NamedStructureSet

chunkX ​

number

chunkZ ​

number

Returns ​

StructureStart | null


startsFor() ​

startsFor(chunkX, chunkZ): readonly StructureStart[]

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:597

Every start whose pieces reach into a chunk.

The scan is Java's createReferences window: eight chunks in each direction, which is what bounds how far a structure may spill from the chunk it started in.

Parameters ​

chunkX ​

number

chunkZ ​

number

Returns ​

readonly StructureStart[]


structuresInStep() ​

structuresInStep(step): readonly string[]

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:320

The structures of a step, in the order Java seeds them.

Every registered structure is counted, whether or not this world generates it, because Java's index runs over the whole registry. The count is also the index the step's first feature is seeded with, which is how structures and features share one counter.

Parameters ​

step ​

"lakes" | "raw_generation" | "local_modifications" | "underground_structures" | "surface_structures" | "strongholds" | "underground_ores" | "underground_decoration" | "fluid_springs" | "vegetal_decoration" | "top_layer_modification"

Returns ​

readonly string[]


unbuiltTypes() ​

unbuiltTypes(): ReadonlySet<string>

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:325

The structure types this server has no builder for.

Returns ​

ReadonlySet<string>


usedSets() ​

usedSets(): readonly NamedStructureSet[]

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureStarts.ts:330

The structure sets this dimension uses, which is what the placement scan runs over.

Returns ​

readonly NamedStructureSet[]