API reference / @jsprismarine/prismarine / world/generators/datadriven/javaStructurePlacement
world/generators/datadriven/javaStructurePlacement
Classes
Interfaces
ChunkRange
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:42
An inclusive rectangle of chunks.
Properties
maxChunkX
readonlymaxChunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:45
maxChunkZ
readonlymaxChunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:46
minChunkX
readonlyminChunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:43
minChunkZ
readonlyminChunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:44
NamedStructureSet
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:36
One worldgen/structure_set, with the identifier it was registered under.
Properties
id
readonlyid:string
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:37
set
readonlyset:StructureSet
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:38
Functions
candidateChunksIn()
candidateChunksIn(
placement,seed,range):ChunkPosition[]
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:90
Every chunk of a range where a structure of this set may start.
Parameters
placement
seed
bigint
range
Returns
The chunks in scan order, which for a random spread is region order.
createTagExpander()
createTagExpander(
tags): (spec) =>ReadonlySet<string>
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:283
Expands a registry reference into the identifiers it names.
A reference is an identifier, a #tag or a list of either, and a tag's values may hold further references. Built over one tag registry: a structure's biomes field expands over tags/worldgen/biome, and the #minecraft:village a /locate names expands over tags/worldgen/structure. A reference this server does not carry contributes nothing, which makes a structure generate in fewer biomes rather than in all of them.
Parameters
tags
Returns
(spec) => ReadonlySet<string>
findBiomeHorizontal()
findBiomeHorizontal(
x,y,z,radius,matches,random,noiseBiome): {x:number;y:number;z:number; } |undefined
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:338
Java's horizontal biome search, the one that moves a stronghold to a biome it prefers.
It scans every quart cell of the square radius blocks out from the point, z then x, at the point's height, and keeps a matching cell by a reservoir draw: the first match outright, the nth with a one in n chance. That is the overload a ring placement calls, which steps one quart at a time and does not look for the closest match, so only the outermost square is walked and the walk covers all of it.
Parameters
x
number
y
number
z
number
radius
number
matches
(biome) => boolean
random
noiseBiome
(quartX, quartY, quartZ) => string
The biome at a quart position.
Returns
{ x: number; y: number; z: number; } | undefined
The block position of the cell kept, or undefined when none matched.
Java Source
BiomeSource.findBiomeHorizontal(IIIIILjava/util/function/Predicate;Lnet/minecraft/util/RandomSource;ZLnet/minecraft/world/level/levelgen/RandomState;)Lcom/mojang/datafixers/util/Pair;
loadStructureSets()
loadStructureSets(
sets,biomesOf,isPossibleBiome):NamedStructureSet[]
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:56
Reads the structure sets a dimension uses.
Parameters
sets
biomesOf
(structure) => ReadonlySet<string>
isPossibleBiome
(biome) => boolean
Whether the dimension's biome source can produce a biome. Java's ChunkGeneratorStructureState keeps a set only when at least one of its structures can generate in a biome the dimension has, so this is what separates the three dimensions.
Returns
structureAttemptsAt()
structureAttemptsAt(
set,seed,chunkX,chunkZ): readonlystring[]
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:263
The structures of a set a chunk tries, in the order Java tries them.
Java draws a structure by weight from a stream seeded by the world seed and the chunk, and when that structure cannot start there it draws again from the rest of the set. The layout of each attempt starts from a second stream seeded identically. Both are reproduced: structureRandomSeed is the seed, and this draws from a source of its own so each layout sees an untouched stream.
Parameters
set
seed
bigint
chunkX
number
chunkZ
number
Returns
readonly string[]
Java See
ChunkGenerator.createStructures
structureRandomSeed()
structureRandomSeed(
seed,chunkX,chunkZ):bigint
Defined in: packages/prismarine/src/world/generators/datadriven/javaStructurePlacement.ts:271
The seed Java gives both the weighted pick and the structure's own layout.
Parameters
seed
bigint
chunkX
number
chunkZ
number
Returns
bigint