API reference / @jsprismarine/features
@jsprismarine/features
Java Edition's decoration pass in TypeScript: all 58 feature types, the ten block state providers and the value providers they are built from, all 18 placement modifiers, and the seeded pipeline that runs them. Everything is read from Mojang's published worldgen/* JSON at load time and pinned to Java Edition 26.3.
import { decorateChunk, FeatureLoader, TestFeatureWorld } from '@jsprismarine/features';
const loader = new FeatureLoader({
feature: (id) => featureDocuments.get(id),
placedFeature: (id) => placedDocuments.get(id),
blockStateProvider: (id) => providerDocuments.get(id)
});
const world = new TestFeatureWorld();
decorateChunk(
[{ feature: loader.placedFeatureById('minecraft:ore_diamond'), step: 'underground_ores', index: 0 }],
{ world },
1234n,
3,
-5
);Block states come out as Java identifiers, because that is what the data names. translatingWorld is where a server attaches @jsprismarine/mapping, so nothing here knows that two editions exist.
Coverage
Measured against the pinned 26.3 data rather than quoted, by the gated corpus test in src/corpus.test.ts.
| Registry | Registered | Implemented | Used by vanilla |
|---|---|---|---|
worldgen/feature_type | 58 | 58 | 47 at the top level, 56 reachable through nesting |
worldgen/placement_modifier_type | 18 | 18 | 15 |
worldgen/block_state_provider_type | 10 | 10 | 9, counting simple in its shorthand form |
int_provider_type | 8 | 8 | 8, counting constant as a bare number |
float_provider_type | 4 | 4 | 4, same |
height_provider_type | 6 | 6 | 6, counting constant as a bare anchor |
block_predicate_type | 16 | 16 | 14 |
rule_test | 10 | 10 | 7 |
worldgen/trunk_placer_type | 10 | 10 | 10 |
worldgen/foliage_placer_type | 12 | 12 | 12 |
worldgen/tree_decorator_type | 11 | 11 | 10 |
worldgen/root_placer_type | 1 | 1 | 1 |
worldgen/feature_size_type | 2 | 2 | 2 |
All 240 configured features and all 273 placed features parse with zero errors. The top of the usage table is tree 45, simple_block 37, ore 30, random_selector 21, overlay 10, weighted_random_selector 8, and block_column, fallen_tree, spring_feature and vegetation_patch at 6 each.
Two things changed in 26.3 that a loader written against 1.21 data gets wrong. random_patch is gone, replaced by projected_random_patchy_square, which thins toward the corners of its square instead of scattering uniformly. And pointed_dripstone and dripstone_cluster became speleothem and speleothem_cluster with their two blocks configurable, which is what lets the nether's sulfur spikes reuse them.
The pipeline and its seeding
A placed feature is a configured feature plus a list of modifiers. placeFeature runs the list and builds the feature at every position it yields.
The traversal is depth first, not stage by stage. The first position a modifier emits runs all the way to the end of the chain before the second one starts. That decides the order of the random draws, so a breadth-first version with the same modifiers produces a different world from the same seed. src/placement/pipeline.ts reproduces Java's stack.
decorateChunk runs a whole chunk. It derives the population seed once from the world seed and the chunk's corner, then reseeds the stream before each feature from that seed, the feature's index in the flattened per-step list, and the step's ordinal. Three properties follow, and the suite checks all three: the same seed and chunk produce the same blocks, a feature that draws fifty extra numbers does not move the next one, and running a subset of the plan leaves the rest where it was.
The eleven decoration steps run in Java's order: raw generation, lakes, local modifications, underground structures, surface structures, strongholds, underground ores, underground decoration, fluid springs, vegetal decoration, top layer modification. orderDecoration sorts a plan into that order, by step and then by index within the step.
WorldgenRandom is not one of @jsprismarine/worldgen's two sources. Java's class extends LegacyRandomSource and overrides only next(bits), so every derived draw uses java.util.Random's formulas over a Xoroshiro bit stream. Handing a feature a plain XoroshiroRandomSource produces different numbers from the first float onward.
The FeatureWorld seam
Features never see a chunk, a section, a palette or a Bedrock identifier. They read and write Java block states through one interface.
interface FeatureWorld {
readonly minY: number;
readonly height: number;
readonly seaLevel: number;
readonly seed: bigint;
readonly blocks: BlockOracle;
getBlock(position: BlockPos): BlockState;
setBlock(position: BlockPos, state: BlockState): boolean;
getHeight(heightmap: HeightmapType, x: number, z: number): number;
getBiome(position: BlockPos): string;
}BlockOracle is a second, smaller interface for the facts about a block state that do not depend on where it sits: isAir, isSolid, isSturdy, isReplaceable, fluid, hasTag and canSurvive. It is separate because the answers are pure and shared. A server builds one oracle from its block registry and tag tables and reuses it for every chunk, while a world adapter exists for one decorated region. A feature still takes one object, because the oracle hangs off the world.
Five optional members cover what a feature needs and world generation does not own: isColdEnoughToSnow for freeze_top_layer and the lake's ice, setBlockEntity for the two chests and the spawner, placeTemplate for template and fossil, spawnEntity for the end spike's crystal, and tagMembers for the one state provider that enumerates a tag rather than testing it. When one is absent the feature does the visible part and skips the rest rather than failing. spawnEntity takes an EntitySpawnOptions object carrying the yaw and the crystal's beam target, base plate and invulnerability, which the server applies to the entity it spawns.
TestFeatureWorld is the in-memory adapter the tests use. It records every write in order, computes heightmaps from the stored blocks so a feature that reads a heightmap after writing sees its own work, and takes its block facts from createTestOracle, which builds an oracle from plain tables of air, fluid, replaceable and tagged identifiers.
translatingWorld(target, mapper, blocks) wraps a world that stores some other state type. That is where @jsprismarine/mapping's Java-to-Bedrock function goes, applied once at the seam rather than inside every feature.
Parity
Two layers, verified two different ways.
The layer below the features is checked against Java itself. utils/oracle/DumpFeatureVectors.java compiles against the pinned 26.3 server jar and writes vectors/features.json, and the tests compare exactly, not within a tolerance.
| Stage | Vectors | Result |
|---|---|---|
setDecorationSeed | 6 world seeds times 6 chunks | exact |
setFeatureSeed and the first three draws | 36 chunks times 11 steps times 3 indices | exact |
| All 11 int providers | 24 draws each | exact |
| All 4 float providers | 24 draws each | exact |
| All 7 height provider shapes | 24 draws each | exact |
WeightedList.getRandomOrThrow | 64 draws | exact |
Biome.BIOME_INFO_NOISE | 5 positions | exact |
Mth.randomBetweenInclusive, nextInt, randomBetween, normal | 16 rounds each | exact |
Refresh the vectors with pnpm --filter @jsprismarine/features run vectors, which needs the pinned jar (pnpm --filter @jsprismarine/bedrock-data run dump:java) and a JDK 25 or newer.
The features and the placement modifiers themselves are checked by behavior and distribution instead. A Java feature takes a WorldGenLevel, which cannot be stood up outside a running server, so there is no cheap way to ask Java what blocks minecraft:oak puts where. The tests assert shape, extent, draw counts and rates: an ore vein stays inside its bounding box across twenty seeds, a geode's four shells nest, a lake's fluid sits below its air, an oak's trunk is a contiguous run of four to six logs with leaves only above it, and the patchy square thins toward its corners.
Against Bedrock the positions cannot match at all, and this is not a gap that effort closes. Bedrock's generator uses an undocumented random source, so the same world seed picks different positions even where the rules agree. cross-edition-worldgen-parity.md section 4 measures where the rules do agree: coal ore's counts, heights, sizes, discard chances and distributions are identical in the two editions, the amethyst geode agrees on chance, height range, block layers and layer probabilities, and the plains flower patch agrees on its 64 tries and its plus or minus 6 by 2 spread while disagreeing on the rate. Test distributions, not equality.
Precision
Java computes much of this in float, and the places where it does are reproduced with Math.fround rather than left as doubles. Two cases are worth naming because they are easy to miss.
Mth.sin and Mth.cos read a 65536-entry float table rather than calling Math.sin. The two differ by up to about 5e-5, which is enough to move an ore vein's sphere radii across a block boundary. support.ts has the table; the worldgen code that calls Mth.sin uses it, and the code that calls java.lang.Math.sin uses Math.sin.
A tree collects its logs, leaves and roots into HashSets, and the decorators then walk them. Java's iteration order is the hash table's bucket order, so which log gets the beehive and which leaf grows a vine depend on BlockPos.hashCode and on how far the table has grown. JavaHashSet reproduces that order.
What a server still has to supply
Seven behaviors live outside world generation in Java too, and they stay outside here. Each one places its visible part and leaves the rest to the caller, so none of them fails silently.
- The sculk spreader.
sculk_patchplaces the seed block. Java runsSculkSpreader, the same charge-and-cursor simulation the sculk catalyst uses at runtime. - The chorus plant.
chorus_plantplaces the flower.ChorusFlowerBlock.generatePlantgrows it. - The multiface spreader.
multiface_growthattaches the first face and draws the roll that decides whether the block's own spreader continues. - Double plants and mossy carpet.
simple_blockhas two branches in Java for blocks that place more than one block, which need the block registry. - The pale moss patch. The
pale_mosstree decorator runsminecraft:pale_moss_patchfrom the feature registry, which the decorator context does not hold. - Structure templates.
templateandfossilname a template and a processor list and hand them toFeatureWorld.placeTemplate, which is where@jsprismarine/structuresattaches. - Loot, spawners, gateways and the end crystal.
monster_room,bonus_chest,end_gatewayandend_spikeplace their blocks and report what belongs in them throughsetBlockEntityandspawnEntity. - The ten spike pillars. Vanilla's
end_spikeships an emptyspikeslist, which means "derive the pillars from the world seed".endSpikesForSeedports Java's derivation: the seed reduces to a 16-bit key through the legacy LCG'snextLong, a second generator seeded by that key shuffles the indices 0 through 9, and each pillar's radius, height and iron-bar cage follow from its shuffled index.
Known gaps
fossilscans the origin's own column for the lowest surface, where Java scans the template's whole footprint. The two agree for the four vanilla fossils, which arrive from a heightmap already, and will differ for a datapack fossil wider than one block on sloped ground.- The
matching_biomesblock predicate matches biomes by name. A#tagreference matches nothing, because this package holds no biome registry. No vanilla feature uses the predicate. random_blockneedsBlockOracle.tagMembersto enumerate a tag. Without it the provider yields nothing and the caller keeps the existing block, which is Java's behavior for an empty holder set.- Block states are compared by identifier and property values, not by a palette index, so a
blockstate_matchrule test compares text. That is the same answer for every vanilla rule and cheaper than carrying a palette.
Running the corpus test
It reads the vanilla datapack from disk, so it is gated:
pnpm --filter @jsprismarine/bedrock-data run fetch:sources
JSP_FEATURE_CORPUS=1 pnpm --filter @jsprismarine/features exec vitest run corpusJSP_VANILLA_DATAPACK points at a local copy instead. Everything it reads is extracted game data and therefore untrusted: it is parsed with JSON.parse and never executed.
Classes
Interfaces
BlockColumnLayer
Defined in: features/simple.ts:714
One band of a block_column: how many blocks and which state they take.
Properties
height
readonlyheight:IntProvider
Defined in: features/simple.ts:716
How tall the band is.
provider
readonlyprovider:BlockStateProvider
Defined in: features/simple.ts:718
What the band is made of.
BlockEntityRequest
Defined in: world/FeatureWorld.ts:168
What a feature asks a world to record on a block it just placed.
Properties
exactTeleport?
readonlyoptionalexactTeleport?:boolean
Defined in: world/FeatureWorld.ts:178
Whether an end gateway places its own exit platform.
exitPortal?
readonlyoptionalexitPortal?:BlockPos
Defined in: world/FeatureWorld.ts:176
Where an end gateway sends a traveller, when the block is one.
id
readonlyid:string
Defined in: world/FeatureWorld.ts:170
The block entity type, for example minecraft:chest.
javaBlock?
readonlyoptionaljavaBlock?:string
Defined in: world/FeatureWorld.ts:187
The Java block the block entity sits in, which is where Java keeps a banner's color.
lootTable?
readonlyoptionallootTable?:string
Defined in: world/FeatureWorld.ts:172
The loot table to roll when the block is first opened, when there is one.
saved?
readonlyoptionalsaved?:unknown
Defined in: world/FeatureWorld.ts:185
The whole block entity as a structure template saved it, when a template saved one.
Typed as unknown because this package does not model NBT and depends on no library that does. The server narrows it before reading it.
spawnEntity?
readonlyoptionalspawnEntity?:string
Defined in: world/FeatureWorld.ts:174
The entity a spawner produces, when the block is a spawner.
BlockOracle
Defined in: world/FeatureWorld.ts:48
The facts about a block state that do not depend on where it sits.
This is a separate seam from FeatureWorld because the answers are pure and shared: a server builds one oracle from its block registry and tag tables and reuses it for every chunk, while a world adapter is created per decorated region. A feature reaches it through FeatureWorld.blocks, so a feature still takes one object.
Methods
canSurvive()
canSurvive(
world,position,state):boolean
Defined in: world/FeatureWorld.ts:66
Answers Java's BlockState.canSurvive(level, pos) for the would_survive predicate.
Parameters
world
position
state
Returns
boolean
fluid()
fluid(
state):FluidKind
Defined in: world/FeatureWorld.ts:58
Returns the fluid the state holds, counting both source blocks and waterlogging.
Parameters
state
Returns
hasTag()
hasTag(
state,tag):boolean
Defined in: world/FeatureWorld.ts:64
Answers whether the state is in a block tag.
Parameters
state
tag
string
The tag identifier with no leading #, for example minecraft:logs.
Returns
boolean
isAir()
isAir(
state):boolean
Defined in: world/FeatureWorld.ts:50
Answers Java's BlockState.isAir().
Parameters
state
Returns
boolean
isReplaceable()
isReplaceable(
state):boolean
Defined in: world/FeatureWorld.ts:56
Answers Java's BlockState.canBeReplaced(), which decides whether a feature may overwrite it.
Parameters
state
Returns
boolean
isSolid()
isSolid(
state):boolean
Defined in: world/FeatureWorld.ts:52
Answers Java's BlockState.isSolid(): the block occupies its whole cell and blocks motion.
Parameters
state
Returns
boolean
isSturdy()
isSturdy(
state,direction):boolean
Defined in: world/FeatureWorld.ts:54
Answers Java's BlockState.isFaceSturdy(level, pos, direction) for a full face.
Parameters
state
direction
Returns
boolean
isUnobstructed()?
optionalisUnobstructed(world,position):boolean
Defined in: world/FeatureWorld.ts:72
Answers Java's isUnobstructed: whether a block-shaped box at the position collides with no entity. Optional, because decoration has no entity list and no vanilla feature asks. When absent the unobstructed predicate passes.
Parameters
world
position
Returns
boolean
tagMembers()?
optionaltagMembers(tag): readonlystring[]
Defined in: world/FeatureWorld.ts:78
Lists the blocks in a tag. Optional, because only the random_block state provider needs to enumerate rather than test, and a server that cannot answer gets Java's empty-set behavior: the provider places nothing.
Parameters
tag
string
Returns
readonly string[]
BlockPos
Defined in: world/FeatureWorld.ts:4
A block position in world coordinates.
Properties
x
readonlyx:number
Defined in: world/FeatureWorld.ts:5
y
readonlyy:number
Defined in: world/FeatureWorld.ts:6
z
readonlyz:number
Defined in: world/FeatureWorld.ts:7
BlockReplacement
Defined in: features/ruleTest.ts:99
A rule test paired with the state to write when it holds, Java's BlockReplacement.
Properties
state
readonlystate:BlockState
Defined in: features/ruleTest.ts:103
What to write in its place.
target
readonlytarget:RuleTest
Defined in: features/ruleTest.ts:101
What the block already there has to be.
BlockState
Defined in: world/BlockState.ts:9
A Java Edition block state: an identifier and the property values that distinguish it from the other states of the same block.
Everything this package produces is Java-shaped. Turning a state into the Bedrock palette entry the server stores is @jsprismarine/mapping's job, reached through the import('./FeatureWorld').FeatureWorld adapter rather than from inside a feature.
Properties
name
readonlyname:string
Defined in: world/BlockState.ts:11
The namespaced block identifier, for example minecraft:oak_log.
properties
readonlyproperties:Readonly<Record<string,string>>
Defined in: world/BlockState.ts:13
Property values keyed by name, as strings, exactly as the JSON spells them.
BlockStateProvider
Defined in: providers/blockStateProvider.ts:26
Chooses the block a feature places at a position, Java's BlockStateProvider.
Features are built almost entirely out of these: a tree's trunk, its leaves, an ore's two targets, a patch's plant and a vegetation patch's ground are all providers rather than fixed states, which is why one tree implementation covers 45 configured trees.
Properties
type
readonlytype:BlockStateProviderTypeName
Defined in: providers/blockStateProvider.ts:28
The provider's registry name.
Methods
getOptionalState()
getOptionalState(
world,random,position):BlockState|undefined
Defined in: providers/blockStateProvider.ts:32
Chooses a state, returning undefined rather than falling back.
Parameters
world
random
position
Returns
BlockState | undefined
getState()
getState(
world,random,position):BlockState
Defined in: providers/blockStateProvider.ts:30
Chooses a state, falling back to the block already at the position when it cannot.
Parameters
world
random
position
Returns
ConfiguredFeature
Defined in: features/Feature.ts:77
A feature type bound to its configuration, Java's ConfiguredFeature.
The 240 vanilla configured features are instances of 47 of the 58 types. Placing one is a pure function of the world, the random stream and an origin, which is what lets the placement pipeline call the same feature at many positions without any per-call setup.
Properties
children?
readonlyoptionalchildren?: readonlyConfiguredFeature[]
Defined in: features/Feature.ts:88
The features this one may delegate to, so a corpus walk can reach every nested type.
type
readonlytype:"sequence"|"bamboo"|"block_blob"|"block_column"|"block_pile"|"blue_ice"|"bonus_chest"|"chorus_plant"|"coral_claw"|"coral_tree"|"delta_feature"|"disk"|"end_gateway"|"end_island"|"end_platform"|"end_podium"|"end_spike"|"fallen_tree"|"fill_layer"|"fossil"|"freeze_top_layer"|"geode"|"huge_brown_mushroom"|"huge_fungus"|"huge_red_mushroom"|"iceberg"|"lake"|"large_dripstone"|"monster_room"|"multiface_growth"|"netherrack_replace_blobs"|"no_op"|"ore"|"overlay"|"projected_random_patchy_square"|"random_boolean_selector"|"random_neighbor_spread"|"random_selector"|"replace_single_block"|"root_system"|"scattered_ore"|"sculk_patch"|"simple_block"|"simple_random_selector"|"single_block_pillar"|"speleothem"|"speleothem_cluster"|"spike"|"spring_feature"|"stepped_column_cluster"|"template"|"tree"|"underwater_magma"|"vegetation_patch"|"vines"|"void_start_platform"|"waterlogged_vegetation_patch"|"weighted_random_selector"
Defined in: features/Feature.ts:79
The feature type's registry name.
Methods
place()
place(
world,random,origin):boolean
Defined in: features/Feature.ts:86
Builds the feature at an origin.
Parameters
world
random
origin
Returns
boolean
Whether anything was placed. Java uses this to decide whether a placed feature counts as having run, and several wrapper features propagate it.
DecorationResult
Defined in: placement/pipeline.ts:138
What decorateChunk did, for a caller that wants to report or assert on it.
Properties
placed
readonlyplaced:number
Defined in: placement/pipeline.ts:142
How many scheduled features reported placing at least one block.
populationSeed
readonlypopulationSeed:bigint
Defined in: placement/pipeline.ts:140
The chunk's population seed, Java's "Decoration Seed" crash-report field.
run
readonlyrun:number
Defined in: placement/pipeline.ts:144
How many were run in total.
DecoratorContext
Defined in: features/tree/shared.ts:125
What a decorator sees of the finished tree.
Properties
leaves
readonlyleaves: readonlyBlockPos[]
Defined in: features/tree/shared.ts:133
Every leaf, sorted the same way.
logs
readonlylogs: readonlyBlockPos[]
Defined in: features/tree/shared.ts:131
Every log, sorted by y with ties in Java's hash order.
random
readonlyrandom:RandomSource
Defined in: features/tree/shared.ts:129
The stream every draw comes from.
roots
readonlyroots: readonlyBlockPos[]
Defined in: features/tree/shared.ts:135
Every root, in Java's hash order.
world
readonlyworld:FeatureWorld
Defined in: features/tree/shared.ts:127
The world being built into.
Methods
setBlock()
setBlock(
position,state):void
Defined in: features/tree/shared.ts:137
Writes a decoration block.
Parameters
position
state
Returns
void
EndSpike
Defined in: features/endSpikes.ts:6
One of the End's ten obsidian pillars, Java's EndSpikeFeature.EndSpike.
Properties
centerX
readonlycenterX:number
Defined in: features/endSpikes.ts:8
The pillar's center x in world coordinates.
centerZ
readonlycenterZ:number
Defined in: features/endSpikes.ts:10
The pillar's center z in world coordinates.
guarded
readonlyguarded:boolean
Defined in: features/endSpikes.ts:16
Whether an iron-bar cage surrounds the pillar's crystal.
height
readonlyheight:number
Defined in: features/endSpikes.ts:14
The y just above the topmost obsidian, where the bedrock cap and the crystal sit.
radius
readonlyradius:number
Defined in: features/endSpikes.ts:12
The obsidian disc's radius.
EntitySpawnOptions
Defined in: world/FeatureWorld.ts:156
What a feature declares about an entity it spawns beyond its type and position.
The three crystal fields carry Java's EndSpikeFeature configuration and the end crystal's synced data to the server, which projects them onto the spawned entity.
Properties
beamTarget?
readonlyoptionalbeamTarget?:BlockPos
Defined in: world/FeatureWorld.ts:160
The block an end crystal's beam points at, Java's crystal_beam_target.
invulnerable?
readonlyoptionalinvulnerable?:boolean
Defined in: world/FeatureWorld.ts:164
Whether the entity ignores damage, Java's crystal_invulnerable.
showBottom?
readonlyoptionalshowBottom?:boolean
Defined in: world/FeatureWorld.ts:162
Whether an end crystal renders its bedrock base plate. Java's default is true.
yaw?
readonlyoptionalyaw?:number
Defined in: world/FeatureWorld.ts:158
The spawn yaw in degrees. Defaults to 0.
FeatureParsers
Defined in: features/parseContext.ts:12
The nested parsers a feature needs that it cannot import directly.
Features reference placed features, placed features reference features, and both reference the registry. Passing the parsers in rather than importing them keeps the cycle out of the module graph and lets a caller resolve minecraft:oak by identifier instead of inlining it.
Methods
blockStateProvider()
blockStateProvider(
source,path):BlockStateProvider
Defined in: features/parseContext.ts:18
Reads a block state provider, resolving a block_state_provider reference.
Parameters
source
unknown
path
string
Returns
direction()
direction(
source,path):Direction
Defined in: features/parseContext.ts:22
Reads any of the six directions.
Parameters
source
unknown
path
string
Returns
fluidState()
fluidState(
source,path):BlockState
Defined in: features/parseContext.ts:31
Reads a fluid state as the block state Java's createLegacyBlock would produce.
A fluid state is not a block state in Java, but every use in the feature data names a source fluid, and a source fluid's legacy block is the fluid block at level zero.
Parameters
source
unknown
path
string
Returns
identifier()
identifier(
source,path):string
Defined in: features/parseContext.ts:20
Reads a registry identifier, normalizing the namespace.
Parameters
source
unknown
path
string
Returns
string
placedFeature()
placedFeature(
source,path):PlacedFeature
Defined in: features/parseContext.ts:14
Reads a nested placed feature, which may be an identifier or an inline document.
Parameters
source
unknown
path
string
Returns
placedFeatureList()
placedFeatureList(
source,path):PlacedFeature[]
Defined in: features/parseContext.ts:16
Reads a list of nested placed features, or a single tag-free identifier.
Parameters
source
unknown
path
string
Returns
verticalDirection()
verticalDirection(
source,path):VerticalDirection
Defined in: features/parseContext.ts:24
Reads up or down.
Parameters
source
unknown
path
string
Returns
FeatureRegistry
Defined in: features/parse.ts:25
Resolves worldgen/feature and worldgen/placed_feature identifiers.
Both registries reference each other, so a loader hands this one object in and gets a lazily resolving reader back. Vanilla's 240 features and 273 placed features form a graph eleven levels deep in places, which is why resolution is by identifier rather than by inlining.
Methods
blockStateProvider()?
optionalblockStateProvider(id):unknown
Defined in: features/parse.ts:36
Returns the parsed JSON of a worldgen/block_state_provider document, or undefined.
26.3 made block state providers a referenceable registry, and vanilla ships eight of them; soil_beneath_tree alone is named by 40 of the 45 configured trees.
Parameters
id
string
Returns
unknown
feature()
feature(
id):unknown
Defined in: features/parse.ts:27
Returns the parsed JSON of a worldgen/feature document, or undefined when absent.
Parameters
id
string
Returns
unknown
placedFeature()
placedFeature(
id):unknown
Defined in: features/parse.ts:29
Returns the parsed JSON of a worldgen/placed_feature document, or undefined.
Parameters
id
string
Returns
unknown
FeatureSize
Defined in: features/tree/shared.ts:67
How wide the tree must be free at each height, Java's FeatureSize.
Properties
minClippedHeight?
readonlyoptionalminClippedHeight?:number
Defined in: features/tree/shared.ts:71
The shortest clipped trunk the tree will still accept, when it accepts one.
type
readonlytype:"two_layers_feature_size"|"three_layers_feature_size"
Defined in: features/tree/shared.ts:69
The registry name.
Methods
sizeAtHeight()
sizeAtHeight(
treeHeight,y):number
Defined in: features/tree/shared.ts:73
The half-width that must be free at a height above the trunk's base.
Parameters
treeHeight
number
y
number
Returns
number
FeatureWorld
Defined in: world/FeatureWorld.ts:93
Everything a feature may do to the world it decorates.
This is the package's only outward seam. Features never see a chunk, a section, a palette or a Bedrock identifier: they read and write Java block states through these seven members, so the server's storage, its Java-to-Bedrock mapping and its chunk lifetime stay on the other side. import('./TestFeatureWorld').TestFeatureWorld is the in-memory adapter the tests use.
Writes are expected to succeed or be dropped silently, as Java's WorldGenLevel.setBlock does outside the region being generated; a feature treats setBlock as advisory and reads back when it needs to know.
Properties
blocks
readonlyblocks:BlockOracle
Defined in: world/FeatureWorld.ts:108
The static block facts, shared across worlds.
height
readonlyheight:number
Defined in: world/FeatureWorld.ts:97
The number of y levels the dimension generates, Java's getHeight().
minY
readonlyminY:number
Defined in: world/FeatureWorld.ts:95
The lowest y the dimension generates, Java's getMinY().
seaLevel
readonlyseaLevel:number
Defined in: world/FeatureWorld.ts:99
The dimension's sea level, which relative_to_sea_level anchors resolve against.
seed
readonlyseed:bigint
Defined in: world/FeatureWorld.ts:106
The world seed.
Only the geode reads it, to build a noise field that is the same everywhere in one world and different between worlds.
Methods
getBiome()
getBiome(
position):string
Defined in: world/FeatureWorld.ts:116
Returns the biome identifier at a position.
Parameters
position
Returns
string
getBlock()
getBlock(
position):BlockState
Defined in: world/FeatureWorld.ts:110
Returns the state at a position, or air outside the generated region.
Parameters
position
Returns
getHeight()
getHeight(
heightmap,x,z):number
Defined in: world/FeatureWorld.ts:114
Returns the first y above the topmost block matching the heightmap's predicate.
Parameters
heightmap
x
number
z
number
Returns
number
isColdEnoughToSnow()?
optionalisColdEnoughToSnow(position):boolean
Defined in: world/FeatureWorld.ts:125
Answers Java's Biome.getTemperature(pos) < 0.15, which is the whole of what decides whether freeze_top_layer acts.
Optional, because biome climate lives in the biome source rather than here. When absent nothing freezes, which is the right answer for a warm world and a visible one for a cold world rather than a silent miss.
Parameters
position
Returns
boolean
placeTemplate()?
optionalplaceTemplate(request):boolean
Defined in: world/FeatureWorld.ts:141
Places a structure template, which template and fossil delegate to.
Optional, and the seam to @jsprismarine/structures: this package names a template and a processor list and does not read NBT. A world that cannot place one reports failure, which propagates through the pipeline the same way an obstructed placement does.
Parameters
request
Returns
boolean
setBlock()
setBlock(
position,state):boolean
Defined in: world/FeatureWorld.ts:112
Writes a state. Returns whether the write landed.
Parameters
position
state
Returns
boolean
setBlockEntity()?
optionalsetBlockEntity(position,data):void
Defined in: world/FeatureWorld.ts:133
Attaches block entity data to a block this package just wrote.
Optional, because only six features need it: the two chests, the spawner, the two end gateway kinds and the end podium. A world that cannot store it loses the contents rather than the block.
Parameters
position
data
Returns
void
spawnEntity()?
optionalspawnEntity(identifier,position,options?):void
Defined in: world/FeatureWorld.ts:147
Spawns an entity a feature builds around, which is only the end spike's crystal.
Optional, because entities belong to the server rather than to world generation.
Parameters
identifier
string
position
options?
Returns
void
FloatProvider
Defined in: providers/valueProviders.ts:207
A draw of one float, Java's FloatProvider.
Four types are registered and vanilla uses all four.
Properties
maxValue
readonlymaxValue:number
Defined in: providers/valueProviders.ts:213
The highest value the provider can return.
minValue
readonlyminValue:number
Defined in: providers/valueProviders.ts:211
The lowest value the provider can return.
type
readonlytype:FloatProviderType
Defined in: providers/valueProviders.ts:209
The provider's registry name.
Methods
sample()
sample(
random):number
Defined in: providers/valueProviders.ts:215
Draws one value.
Parameters
random
Returns
number
FoliageAttachment
Defined in: features/tree/shared.ts:36
Where a foliage placer hangs its leaves, Java's FoliageAttachment.
Properties
foliageHeightOffset
readonlyfoliageHeightOffset:number
Defined in: features/tree/shared.ts:42
How much taller than the configured height this attachment's foliage is.
pos
readonlypos:BlockPos
Defined in: features/tree/shared.ts:38
The block the foliage grows around.
radiusOffsetXZ
readonlyradiusOffsetXZ:number
Defined in: features/tree/shared.ts:40
How much wider than the configured radius this attachment's foliage is.
sizeX
readonlysizeX:number
Defined in: features/tree/shared.ts:44
The trunk's x extent at the attachment, 1 for a normal tree and 2 for a giant one.
sizeZ
readonlysizeZ:number
Defined in: features/tree/shared.ts:46
The trunk's z extent at the attachment.
FoliagePlacer
Defined in: features/tree/shared.ts:89
Lays out the leaves around an attachment, Java's FoliagePlacer.
Properties
type
readonlytype:string
Defined in: features/tree/shared.ts:91
The registry name.
Methods
create()
create(
context,treeHeight,entry,foliageHeight,leafRadius):void
Defined in: features/tree/shared.ts:97
Builds the leaves for one attachment.
Parameters
context
treeHeight
number
entry
foliageHeight
number
leafRadius
number
Returns
void
foliageHeight()
foliageHeight(
random,treeHeight):number
Defined in: features/tree/shared.ts:93
Draws how tall the foliage is.
Parameters
random
treeHeight
number
Returns
number
foliageRadius()
foliageRadius(
random,trunkHeight):number
Defined in: features/tree/shared.ts:95
Draws how wide the foliage is.
Parameters
random
trunkHeight
number
Returns
number
GeodeConfig
Defined in: features/structural.ts:61
How a geode is shaped and what it is made of.
Properties
alternateInnerLayerProvider
readonlyalternateInnerLayerProvider:BlockStateProvider
Defined in: features/structural.ts:64
baseCrackSize
readonlybaseCrackSize:number
Defined in: features/structural.ts:75
cannotReplace
readonlycannotReplace:BlockSet
Defined in: features/structural.ts:68
crackPointOffset
readonlycrackPointOffset:number
Defined in: features/structural.ts:76
distributionPoints
readonlydistributionPoints:IntProvider
Defined in: features/structural.ts:81
filling
readonlyfilling:number
Defined in: features/structural.ts:70
fillingProvider
readonlyfillingProvider:BlockStateProvider
Defined in: features/structural.ts:62
generateCrackChance
readonlygenerateCrackChance:number
Defined in: features/structural.ts:74
innerLayer
readonlyinnerLayer:number
Defined in: features/structural.ts:71
innerLayerProvider
readonlyinnerLayerProvider:BlockStateProvider
Defined in: features/structural.ts:63
innerPlacements
readonlyinnerPlacements: readonlyBlockState[]
Defined in: features/structural.ts:67
invalidBlocks
readonlyinvalidBlocks:BlockSet
Defined in: features/structural.ts:69
invalidBlocksThreshold
readonlyinvalidBlocksThreshold:number
Defined in: features/structural.ts:86
maxGenOffset
readonlymaxGenOffset:number
Defined in: features/structural.ts:84
middleLayer
readonlymiddleLayer:number
Defined in: features/structural.ts:72
middleLayerProvider
readonlymiddleLayerProvider:BlockStateProvider
Defined in: features/structural.ts:65
minGenOffset
readonlyminGenOffset:number
Defined in: features/structural.ts:83
noiseMultiplier
readonlynoiseMultiplier:number
Defined in: features/structural.ts:85
outerLayer
readonlyouterLayer:number
Defined in: features/structural.ts:73
outerLayerProvider
readonlyouterLayerProvider:BlockStateProvider
Defined in: features/structural.ts:66
outerWallDistance
readonlyouterWallDistance:IntProvider
Defined in: features/structural.ts:80
placementsRequireLayer0Alternate
readonlyplacementsRequireLayer0Alternate:boolean
Defined in: features/structural.ts:79
pointOffset
readonlypointOffset:IntProvider
Defined in: features/structural.ts:82
useAlternateLayer0Chance
readonlyuseAlternateLayer0Chance:number
Defined in: features/structural.ts:78
usePotentialPlacementsChance
readonlyusePotentialPlacementsChance:number
Defined in: features/structural.ts:77
HeightProvider
Defined in: providers/heightProvider.ts:73
A draw of one y, Java's HeightProvider.
It differs from an import('./valueProviders').IntProvider in taking a VerticalContext, because its bounds are anchors rather than numbers.
Properties
type
readonlytype:HeightProviderType
Defined in: providers/heightProvider.ts:75
The provider's registry name.
Methods
sample()
sample(
random,context):number
Defined in: providers/heightProvider.ts:77
Draws one y.
Parameters
random
context
Returns
number
HugeMushroomConfig
Defined in: features/structural.ts:1105
How a huge mushroom is shaped.
Properties
canPlaceOn
readonlycanPlaceOn:BlockPredicate
Defined in: features/structural.ts:1109
capProvider
readonlycapProvider:BlockStateProvider
Defined in: features/structural.ts:1106
foliageRadius
readonlyfoliageRadius:number
Defined in: features/structural.ts:1108
stemProvider
readonlystemProvider:BlockStateProvider
Defined in: features/structural.ts:1107
IntProvider
Defined in: providers/valueProviders.ts:18
A draw of one integer, Java's IntProvider.
Counts, heights, radii and offsets throughout the feature data are providers rather than numbers, and the number of draws each one costs is part of the world's seed contract: a very_biased_to_bottom costs three draws where a uniform costs one, so substituting a distribution changes every value drawn after it.
Properties
maxValue
readonlymaxValue:number
Defined in: providers/valueProviders.ts:24
The highest value the provider can return.
minValue
readonlyminValue:number
Defined in: providers/valueProviders.ts:22
The lowest value the provider can return.
type
readonlytype:IntProviderType
Defined in: providers/valueProviders.ts:20
The provider's registry name, for example uniform.
Methods
sample()
sample(
random):number
Defined in: providers/valueProviders.ts:26
Draws one value, consuming the provider's fixed number of draws.
Parameters
random
Returns
number
LargeDripstoneConfig
Defined in: features/caves.ts:399
How a large dripstone is shaped.
Properties
columnRadius
readonlycolumnRadius:IntProvider
Defined in: features/caves.ts:402
floorToCeilingSearchRange
readonlyfloorToCeilingSearchRange:number
Defined in: features/caves.ts:401
heightScale
readonlyheightScale:FloatProvider
Defined in: features/caves.ts:403
maxColumnRadiusToCaveHeightRatio
readonlymaxColumnRadiusToCaveHeightRatio:number
Defined in: features/caves.ts:404
minBluntnessForWind
readonlyminBluntnessForWind:number
Defined in: features/caves.ts:409
minRadiusForWind
readonlyminRadiusForWind:number
Defined in: features/caves.ts:408
replaceableBlocks
readonlyreplaceableBlocks:BlockSet
Defined in: features/caves.ts:400
stalactiteBluntness
readonlystalactiteBluntness:FloatProvider
Defined in: features/caves.ts:405
stalagmiteBluntness
readonlystalagmiteBluntness:FloatProvider
Defined in: features/caves.ts:406
windSpeed
readonlywindSpeed:FloatProvider
Defined in: features/caves.ts:407
PlacedFeature
Defined in: placement/pipeline.ts:43
A feature plus the modifier chain that decides where it goes, Java's PlacedFeature.
The 273 vanilla placed features are all of this shape: a reference to one of the 240 configured features and between zero and six modifiers.
Properties
feature
readonlyfeature:ConfiguredFeature
Defined in: placement/pipeline.ts:45
The feature placed at each position the chain produces.
placement
readonlyplacement: readonlyPlacementModifier[]
Defined in: placement/pipeline.ts:47
The modifier chain, run in order.
PlacementContext
Defined in: placement/modifiers.ts:28
What a modifier is allowed to ask about the world while it transforms positions.
Properties
featureBelongsToBiome?
readonlyoptionalfeatureBelongsToBiome?: (position) =>boolean
Defined in: placement/modifiers.ts:38
Answers whether the placed feature being run is listed for the biome at a position, which is the whole of what minecraft:biome does.
The chunk generator supplies this, because the biome-to-feature table lives there. When a caller places one feature directly, the default accepts every position.
Parameters
position
Returns
boolean
world
readonlyworld:FeatureWorld
Defined in: placement/modifiers.ts:30
The world being decorated.
PlacementModifier
Defined in: placement/modifiers.ts:47
One stage of a placed feature's pipeline, Java's PlacementModifier.
A modifier takes one position and emits zero, one or many. Filters emit zero or one, spreads emit one moved, and counts emit the same position several times. The pipeline composes them.
Properties
type
readonlytype:PlacementModifierTypeName
Defined in: placement/modifiers.ts:49
The modifier's registry name.
Methods
modify()
modify(
context,random,origin,output):void
Defined in: placement/modifiers.ts:51
Transforms one position, pushing each result to output.
Parameters
context
random
origin
output
(position) => void
Returns
void
RootPlacer
Defined in: features/tree/shared.ts:107
Lays out the roots below the trunk, Java's RootPlacer.
Properties
type
readonlytype:"mangrove_root_placer"
Defined in: features/tree/shared.ts:109
The registry name.
Methods
place()
place(
context,origin,trunkOrigin):boolean
Defined in: features/tree/shared.ts:113
Builds the roots. Returns false to abandon the whole tree.
Parameters
context
origin
trunkOrigin
Returns
boolean
trunkOrigin()
trunkOrigin(
origin,random):BlockPos
Defined in: features/tree/shared.ts:111
Returns where the trunk starts, which a root placer raises above the origin.
Parameters
origin
random
Returns
RootSystemConfig
Defined in: features/structural.ts:670
How a root system is shaped.
Properties
allowedTreePosition
readonlyallowedTreePosition:BlockPredicate
Defined in: features/structural.ts:685
allowedVerticalWaterForTree
readonlyallowedVerticalWaterForTree:number
Defined in: features/structural.ts:684
hangingRootPlacementAttempts
readonlyhangingRootPlacementAttempts:number
Defined in: features/structural.ts:683
hangingRootRadius
readonlyhangingRootRadius:number
Defined in: features/structural.ts:680
hangingRootStateProvider
readonlyhangingRootStateProvider:BlockStateProvider
Defined in: features/structural.ts:682
hangingRootsVerticalSpan
readonlyhangingRootsVerticalSpan:number
Defined in: features/structural.ts:681
levelTestDistance
readonlylevelTestDistance:number
Defined in: features/structural.ts:673
maxLevelDeviation
readonlymaxLevelDeviation:number
Defined in: features/structural.ts:674
requiredVerticalSpaceForTree
readonlyrequiredVerticalSpaceForTree:number
Defined in: features/structural.ts:672
rootColumnMaxHeight
readonlyrootColumnMaxHeight:number
Defined in: features/structural.ts:679
rootPlacementAttempts
readonlyrootPlacementAttempts:number
Defined in: features/structural.ts:678
rootRadius
readonlyrootRadius:number
Defined in: features/structural.ts:675
rootReplaceable
readonlyrootReplaceable:BlockSet
Defined in: features/structural.ts:676
rootStateProvider
readonlyrootStateProvider:BlockStateProvider
Defined in: features/structural.ts:677
treeFeature
readonlytreeFeature:PlacedFeature
Defined in: features/structural.ts:671
ScannedColumn
Defined in: features/caves.ts:45
A scanned column: the first non-matching block below and above the origin.
Properties
ceiling?
readonlyoptionalceiling?:number
Defined in: features/caves.ts:49
The y of the first block above the origin that fails inside, when there is one.
floor?
readonlyoptionalfloor?:number
Defined in: features/caves.ts:47
The y of the first block below the origin that fails inside, when there is one.
height?
readonlyoptionalheight?:number
Defined in: features/caves.ts:51
How many inside blocks sit strictly between the floor and the ceiling.
ScheduledFeature
Defined in: placement/pipeline.ts:100
One entry of a chunk's decoration plan: a placed feature, its step and its index in that step.
Properties
feature
readonlyfeature:PlacedFeature
Defined in: placement/pipeline.ts:102
The placed feature to run.
index
readonlyindex:number
Defined in: placement/pipeline.ts:112
The feature's index within the step's flattened, de-duplicated feature list.
Java builds one list per step across every biome in the world, so the index is global to the dimension rather than local to the chunk or the biome. Two chunks in different biomes therefore seed the same feature identically.
step
readonlystep:"lakes"|"raw_generation"|"local_modifications"|"underground_structures"|"surface_structures"|"strongholds"|"underground_ores"|"underground_decoration"|"fluid_springs"|"vegetal_decoration"|"top_layer_modification"
Defined in: placement/pipeline.ts:104
The decoration step it belongs to.
SpeleothemClusterConfig
Defined in: features/caves.ts:201
How a speleothem cluster is shaped.
Properties
baseBlock
readonlybaseBlock:string
Defined in: features/caves.ts:202
chanceOfSpeleothemAtMaxDistanceFromCenter
readonlychanceOfSpeleothemAtMaxDistanceFromCenter:number
Defined in: features/caves.ts:213
density
readonlydensity:FloatProvider
Defined in: features/caves.ts:211
floorToCeilingSearchRange
readonlyfloorToCeilingSearchRange:number
Defined in: features/caves.ts:205
height
readonlyheight:IntProvider
Defined in: features/caves.ts:206
heightDeviation
readonlyheightDeviation:number
Defined in: features/caves.ts:209
maxDistanceFromCenterAffectingHeightBias
readonlymaxDistanceFromCenterAffectingHeightBias:number
Defined in: features/caves.ts:215
maxDistanceFromEdgeAffectingChanceOfSpeleothem
readonlymaxDistanceFromEdgeAffectingChanceOfSpeleothem:number
Defined in: features/caves.ts:214
maxStalagmiteStalactiteHeightDiff
readonlymaxStalagmiteStalactiteHeightDiff:number
Defined in: features/caves.ts:208
pointedBlock
readonlypointedBlock:string
Defined in: features/caves.ts:203
radius
readonlyradius:IntProvider
Defined in: features/caves.ts:207
replaceableBlocks
readonlyreplaceableBlocks:BlockSet
Defined in: features/caves.ts:204
speleothemBlockLayerThickness
readonlyspeleothemBlockLayerThickness:IntProvider
Defined in: features/caves.ts:210
wetness
readonlywetness:FloatProvider
Defined in: features/caves.ts:212
SteppedColumnClusterConfig
Defined in: features/caves.ts:685
How a stepped column cluster is shaped.
Properties
block
readonlyblock:BlockStateProvider
Defined in: features/caves.ts:686
cannotPlaceOn
readonlycannotPlaceOn:BlockSet
Defined in: features/caves.ts:689
canReplace
readonlycanReplace:BlockPredicate
Defined in: features/caves.ts:688
clusterReach
readonlyclusterReach:IntProvider
Defined in: features/caves.ts:690
columnCount
readonlycolumnCount:IntProvider
Defined in: features/caves.ts:691
columnReach
readonlycolumnReach:IntProvider
Defined in: features/caves.ts:692
continueThrough
readonlycontinueThrough:BlockPredicate
Defined in: features/caves.ts:687
height
readonlyheight:IntProvider
Defined in: features/caves.ts:693
TargetWorld
Defined in: world/FeatureWorld.ts:237
A world that stores some other state type, which translatingWorld adapts.
Extends
Omit<FeatureWorld,"getBlock"|"setBlock"|"blocks">
Type Parameters
Target
Target
Properties
height
readonlyheight:number
Defined in: world/FeatureWorld.ts:97
The number of y levels the dimension generates, Java's getHeight().
Inherited from
isColdEnoughToSnow?
optionalisColdEnoughToSnow?: (position) =>boolean
Defined in: world/FeatureWorld.ts:125
Answers Java's Biome.getTemperature(pos) < 0.15, which is the whole of what decides whether freeze_top_layer acts.
Optional, because biome climate lives in the biome source rather than here. When absent nothing freezes, which is the right answer for a warm world and a visible one for a cold world rather than a silent miss.
Parameters
position
Returns
boolean
Inherited from
FeatureWorld.isColdEnoughToSnow
minY
readonlyminY:number
Defined in: world/FeatureWorld.ts:95
The lowest y the dimension generates, Java's getMinY().
Inherited from
placeTemplate?
optionalplaceTemplate?: (request) =>boolean
Defined in: world/FeatureWorld.ts:141
Places a structure template, which template and fossil delegate to.
Optional, and the seam to @jsprismarine/structures: this package names a template and a processor list and does not read NBT. A world that cannot place one reports failure, which propagates through the pipeline the same way an obstructed placement does.
Parameters
request
Returns
boolean
Inherited from
seaLevel
readonlyseaLevel:number
Defined in: world/FeatureWorld.ts:99
The dimension's sea level, which relative_to_sea_level anchors resolve against.
Inherited from
seed
readonlyseed:bigint
Defined in: world/FeatureWorld.ts:106
The world seed.
Only the geode reads it, to build a noise field that is the same everywhere in one world and different between worlds.
Inherited from
setBlockEntity?
optionalsetBlockEntity?: (position,data) =>void
Defined in: world/FeatureWorld.ts:133
Attaches block entity data to a block this package just wrote.
Optional, because only six features need it: the two chests, the spawner, the two end gateway kinds and the end podium. A world that cannot store it loses the contents rather than the block.
Parameters
position
data
Returns
void
Inherited from
spawnEntity?
optionalspawnEntity?: (identifier,position,options?) =>void
Defined in: world/FeatureWorld.ts:147
Spawns an entity a feature builds around, which is only the end spike's crystal.
Optional, because entities belong to the server rather than to world generation.
Parameters
identifier
string
position
options?
Returns
void
Inherited from
Methods
getBiome()
getBiome(
position):string
Defined in: world/FeatureWorld.ts:116
Returns the biome identifier at a position.
Parameters
position
Returns
string
Inherited from
getBlock()
getBlock(
position):Target
Defined in: world/FeatureWorld.ts:238
Parameters
position
Returns
Target
getHeight()
getHeight(
heightmap,x,z):number
Defined in: world/FeatureWorld.ts:114
Returns the first y above the topmost block matching the heightmap's predicate.
Parameters
heightmap
x
number
z
number
Returns
number
Inherited from
setBlock()
setBlock(
position,state):boolean
Defined in: world/FeatureWorld.ts:239
Parameters
position
state
Target
Returns
boolean
TemplateRequest
Defined in: world/FeatureWorld.ts:200
What a feature asks a world to stamp out of a structure template.
Properties
mirror
readonlymirror:"none"|"left_right"|"front_back"
Defined in: world/FeatureWorld.ts:208
The mirror to apply before the rotation.
offset?
readonlyoptionaloffset?:BlockPos
Defined in: world/FeatureWorld.ts:212
The template's own offset, which template carries as offset.
origin
readonlyorigin:BlockPos
Defined in: world/FeatureWorld.ts:204
Where the template's origin corner lands.
overwrite?
readonlyoptionaloverwrite?:boolean
Defined in: world/FeatureWorld.ts:216
Whether air in the template overwrites the world.
processors?
readonlyoptionalprocessors?:TemplateProcessors
Defined in: world/FeatureWorld.ts:210
The processors to run over the template, when the feature carries any.
projectToHeightmap?
readonlyoptionalprojectToHeightmap?:HeightmapType
Defined in: world/FeatureWorld.ts:214
Whether the template's project-to-heightmap mode is set, and to which heightmap.
rotation
readonlyrotation:number
Defined in: world/FeatureWorld.ts:206
The quarter turns to apply, 0 through 3.
template
readonlytemplate:string
Defined in: world/FeatureWorld.ts:202
The template identifier, for example minecraft:trail_ruins/tower/tower_top.
TestFeatureWorldOptions
Defined in: world/TestFeatureWorld.ts:71
How a test world is sized and what it knows about blocks.
Properties
biome?
readonlyoptionalbiome?:string
Defined in: world/TestFeatureWorld.ts:79
The biome every position reports. Defaults to minecraft:plains.
blocks?
readonlyoptionalblocks?:BlockOracle
Defined in: world/TestFeatureWorld.ts:83
The block facts. Defaults to createTestOracle with no tables.
height?
readonlyoptionalheight?:number
Defined in: world/TestFeatureWorld.ts:75
The number of generated y levels. Defaults to 384, the overworld's.
minY?
readonlyoptionalminY?:number
Defined in: world/TestFeatureWorld.ts:73
The lowest generated y. Defaults to -64, the overworld's.
seaLevel?
readonlyoptionalseaLevel?:number
Defined in: world/TestFeatureWorld.ts:77
The sea level relative_to_sea_level resolves against. Defaults to 63.
seed?
readonlyoptionalseed?:bigint
Defined in: world/TestFeatureWorld.ts:81
The world seed. Defaults to zero.
TestOracleTables
Defined in: world/TestFeatureWorld.ts:10
What a caller may declare about the blocks a test uses.
Properties
air?
readonlyoptionalair?: readonlystring[]
Defined in: world/TestFeatureWorld.ts:12
Identifiers that count as air. Defaults to the three vanilla air blocks.
canSurvive?
readonlyoptionalcanSurvive?: (world,position,state) =>boolean
Defined in: world/TestFeatureWorld.ts:22
Overrides canSurvive. The default asks whether the block below is solid.
Parameters
world
position
state
Returns
boolean
fluids?
readonlyoptionalfluids?:Readonly<Record<string,FluidKind>>
Defined in: world/TestFeatureWorld.ts:14
Identifiers that hold a fluid, and which one. Waterlogged states are detected separately.
nonSolid?
readonlyoptionalnonSolid?: readonlystring[]
Defined in: world/TestFeatureWorld.ts:18
Identifiers that do not fill their cell. Everything else is solid and sturdy on every face.
replaceable?
readonlyoptionalreplaceable?: readonlystring[]
Defined in: world/TestFeatureWorld.ts:16
Identifiers a feature may overwrite. Air and fluids are always replaceable.
tags?
readonlyoptionaltags?:Readonly<Record<string, readonlystring[]>>
Defined in: world/TestFeatureWorld.ts:20
Tag membership, keyed by tag identifier with no leading #.
TreeConfig
Defined in: features/tree/shared.ts:141
A parsed minecraft:tree configuration.
Properties
belowTrunkProvider
readonlybelowTrunkProvider:BlockStateProvider
Defined in: features/tree/shared.ts:159
What the trunk puts into the block it stands on.
decorators
readonlydecorators: readonlyTreeDecorator[]
Defined in: features/tree/shared.ts:155
What is added after the trunk and foliage.
foliagePlacer
readonlyfoliagePlacer:FoliagePlacer
Defined in: features/tree/shared.ts:149
The foliage layout.
foliageProvider
readonlyfoliageProvider:BlockStateProvider
Defined in: features/tree/shared.ts:147
The leaf the foliage is made of.
ignoreVines
readonlyignoreVines:boolean
Defined in: features/tree/shared.ts:157
Whether a vine in the way stops the tree.
minimumSize
readonlyminimumSize:FeatureSize
Defined in: features/tree/shared.ts:153
How much room the tree needs.
rootPlacer?
readonlyoptionalrootPlacer?:RootPlacer
Defined in: features/tree/shared.ts:151
The root layout, when the tree has roots.
trunkPlacer
readonlytrunkPlacer:TrunkPlacer
Defined in: features/tree/shared.ts:145
The trunk layout.
trunkProvider
readonlytrunkProvider:BlockStateProvider
Defined in: features/tree/shared.ts:143
The log the trunk is made of.
TreeContext
Defined in: features/tree/shared.ts:18
Everything a placer needs from the tree it belongs to.
Properties
config
readonlyconfig:TreeConfig
Defined in: features/tree/shared.ts:24
The tree's configuration.
random
readonlyrandom:RandomSource
Defined in: features/tree/shared.ts:22
The stream every draw comes from.
world
readonlyworld:FeatureWorld
Defined in: features/tree/shared.ts:20
The world being built into.
Methods
hasFoliage()
hasFoliage(
position):boolean
Defined in: features/tree/shared.ts:32
Answers whether a leaf was already placed here by this tree.
Parameters
position
Returns
boolean
setFoliage()
setFoliage(
position,state):void
Defined in: features/tree/shared.ts:30
Records a leaf.
Parameters
position
state
Returns
void
setRoot()
setRoot(
position,state):void
Defined in: features/tree/shared.ts:28
Records a root.
Parameters
position
state
Returns
void
setTrunk()
setTrunk(
position,state):void
Defined in: features/tree/shared.ts:26
Records a log or a root.
Parameters
position
state
Returns
void
TreeDecorator
Defined in: features/tree/shared.ts:117
Adds the hives, vines, mushrooms and ground cover a tree carries, Java's TreeDecorator.
Properties
type
readonlytype:string
Defined in: features/tree/shared.ts:119
The registry name.
Methods
place()
place(
context):void
Defined in: features/tree/shared.ts:121
Runs over the finished tree.
Parameters
context
Returns
void
TrunkPlacer
Defined in: features/tree/shared.ts:77
Lays out the trunk and reports where the foliage attaches, Java's TrunkPlacer.
Properties
type
readonlytype:string
Defined in: features/tree/shared.ts:79
The registry name.
Methods
isFree()
isFree(
world,position):boolean
Defined in: features/tree/shared.ts:85
Answers whether a position does not block the trunk, which the free-height scan reads.
Parameters
world
position
Returns
boolean
place()
place(
context,treeHeight,origin):FoliageAttachment[]
Defined in: features/tree/shared.ts:83
Builds the trunk and returns the foliage attachments.
Parameters
context
treeHeight
number
origin
Returns
treeHeight()
treeHeight(
random):number
Defined in: features/tree/shared.ts:81
Draws the tree's total height.
Parameters
random
Returns
number
VegetationPatchConfig
Defined in: features/caves.ts:542
How a vegetation patch is shaped.
Properties
depth
readonlydepth:IntProvider
Defined in: features/caves.ts:547
extraBottomBlockChance
readonlyextraBottomBlockChance:number
Defined in: features/caves.ts:548
extraEdgeColumnChance
readonlyextraEdgeColumnChance:number
Defined in: features/caves.ts:552
groundState
readonlygroundState:BlockStateProvider
Defined in: features/caves.ts:544
replaceable
readonlyreplaceable:BlockSet
Defined in: features/caves.ts:543
surface
readonlysurface:"floor"|"ceiling"
Defined in: features/caves.ts:546
vegetationChance
readonlyvegetationChance:number
Defined in: features/caves.ts:550
vegetationFeature
readonlyvegetationFeature:PlacedFeature
Defined in: features/caves.ts:545
verticalRange
readonlyverticalRange:number
Defined in: features/caves.ts:549
xzRadius
readonlyxzRadius:IntProvider
Defined in: features/caves.ts:551
VerticalContext
Defined in: providers/heightProvider.ts:15
What a height provider needs from the dimension to turn an anchor into a y.
It is the three numbers of Java's WorldGenerationContext, so a caller can resolve a height without a world.
Properties
height
readonlyheight:number
Defined in: providers/heightProvider.ts:19
The number of generated y levels.
minY
readonlyminY:number
Defined in: providers/heightProvider.ts:17
The lowest generated y.
seaLevel
readonlyseaLevel:number
Defined in: providers/heightProvider.ts:21
The dimension's sea level.
Weighted
Defined in: placement/WorldgenRandom.ts:255
An entry in a Java WeightedList.
Type Parameters
T
T
Properties
value
readonlyvalue:T
Defined in: placement/WorldgenRandom.ts:256
weight
readonlyweight:number
Defined in: placement/WorldgenRandom.ts:257
WorldgenRandomState
Defined in: placement/WorldgenRandom.ts:14
JSON-safe continuation state for Java's reseedable world-generation stream.
Properties
algorithm
readonlyalgorithm:WorldgenRandomAlgorithm
Defined in: placement/WorldgenRandom.ts:16
delegate
readonlydelegate:LegacyRandomSourceState|XoroshiroRandomSourceState
Defined in: placement/WorldgenRandom.ts:17
gaussian
readonlygaussian:GaussianCacheState
Defined in: placement/WorldgenRandom.ts:18
version
readonlyversion:1
Defined in: placement/WorldgenRandom.ts:15
Type Aliases
BlockPredicate
BlockPredicate = (
world,position) =>boolean
Defined in: providers/blockPredicate.ts:17
A test on one world position, Java's BlockPredicate.
Predicates gate placement (block_predicate_filter), stop a scan (environment_scan) and decide what a feature may overwrite. They draw no randomness, so running one costs nothing against the seed and a feature can test freely.
Parameters
world
position
Returns
boolean
BlockPredicateTypeName
BlockPredicateTypeName =
"matching_blocks"|"matching_block_tag"|"matching_fluids"|"matching_biomes"|"has_sturdy_face"|"solid"|"replaceable"|"would_survive"|"inside_world_bounds"|"any_of"|"all_of"|"not"|"true"|"unobstructed"|"height_range"|"volume_match"
Defined in: providers/blockPredicate.ts:20
The sixteen types Java 26.3 registers in block_predicate_type.
BlockSet
BlockSet = {
kind:"tag";tag:string; } | {kind:"blocks";names: readonlystring[]; }
Defined in: registry.ts:36
A reference to a set of blocks: either one identifier or a #-prefixed tag.
Java's HolderSet also accepts an inline list; features_cannot_replace and the geode's invalid-block set are the two shapes the vanilla feature data actually uses.
BlockStateMapper
BlockStateMapper<
Target> =object
Defined in: world/FeatureWorld.ts:229
Translates the Java block states a feature writes into whatever the target world stores.
A server supplies @jsprismarine/mapping's Java-to-Bedrock function here. Nothing in this package knows that two editions exist.
Type Parameters
Target
Target
Methods
toJava()
toJava(
state):BlockState
Defined in: world/FeatureWorld.ts:233
Converts a target state back into Java, so predicates and reads keep working.
Parameters
state
Target
Returns
toTarget()
toTarget(
state):Target
Defined in: world/FeatureWorld.ts:231
Converts a Java state into the target world's state type.
Parameters
state
Returns
Target
BlockStateProviderResolver
BlockStateProviderResolver = (
id,path) =>BlockStateProvider
Defined in: providers/blockStateProvider.ts:243
Resolves a worldgen/block_state_provider reference to its parsed provider.
Parameters
id
string
path
string
Returns
BlockStateProviderTypeName
BlockStateProviderTypeName =
"simple"|"weighted"|"noise"|"dual_noise"|"noise_threshold"|"randomized_int"|"rotated"|"rule_based"|"random_block"|"copy_properties"
Defined in: providers/blockStateProvider.ts:36
The ten types Java 26.3 registers in worldgen/block_state_provider_type.
DecorationStep
DecorationStep = typeof
DECORATION_STEPS[number]
Defined in: placement/pipeline.ts:32
One of the eleven decoration steps.
Direction
Direction =
"down"|"up"|"north"|"south"|"west"|"east"
Defined in: world/BlockState.ts:20
The six block faces, spelled as Java spells a Direction.
FeatureTypeName
FeatureTypeName = typeof
FEATURE_TYPES[number]
Defined in: features/Feature.ts:68
One of the 58 registered feature types.
FeatureTypeUsage
FeatureTypeUsage =
ReadonlyMap<FeatureTypeName,number>
Defined in: features/parse.ts:169
A feature type and how many of the parsed documents used it.
FloatProviderType
FloatProviderType =
"constant"|"uniform"|"trapezoid"|"clamped_normal"
Defined in: providers/valueProviders.ts:219
The four types Java 26.3 registers in float_provider_type.
FluidKind
FluidKind =
"empty"|"water"|"lava"
Defined in: world/BlockState.ts:17
The three fluids a block state can hold, which is all the feature code distinguishes.
HeightProviderType
HeightProviderType =
"constant"|"uniform"|"biased_to_bottom"|"very_biased_to_bottom"|"trapezoid"|"weighted_list"
Defined in: providers/heightProvider.ts:81
The six types Java 26.3 registers in height_provider_type.
HeightmapType
HeightmapType =
"WORLD_SURFACE_WG"|"WORLD_SURFACE"|"OCEAN_FLOOR_WG"|"OCEAN_FLOOR"|"MOTION_BLOCKING"|"MOTION_BLOCKING_NO_LEAVES"
Defined in: world/FeatureWorld.ts:32
The six heightmaps Java Edition keeps, named as the placement JSON spells them.
The three _WG and OCEAN_FLOOR/WORLD_SURFACE pairs differ only in when they are computed, so a generator that decorates a chunk once can answer both from the same column scan.
IntProviderType
IntProviderType =
"constant"|"uniform"|"biased_to_bottom"|"very_biased_to_bottom"|"trapezoid"|"clamped"|"clamped_normal"|"weighted_list"
Defined in: providers/valueProviders.ts:30
The eight types Java 26.3 registers in int_provider_type.
PlacementModifierTypeName
PlacementModifierTypeName =
"block_predicate_filter"|"rarity_filter"|"random_chance"|"surface_relative_threshold_filter"|"surface_water_depth_filter"|"biome"|"count"|"noise_based_count"|"noise_threshold_count"|"count_on_every_layer"|"cuboid"|"environment_scan"|"heightmap"|"height_range"|"in_square"|"offset"|"randomly_selected"|"fixed_placement"
Defined in: placement/modifiers.ts:60
The eighteen types Java 26.3 registers in worldgen/placement_modifier_type.
RuleTest
RuleTest = (
blocks,state,position,random) =>boolean
Defined in: features/ruleTest.ts:18
A test on a block state and its position, Java's RuleTest.
Ores use these to decide what they may cut through, which is why ore_diamond can place deepslate diamond below y 8 and ordinary diamond above it from one feature. Unlike a import('../providers/blockPredicate').BlockPredicate it never reads the world: it is handed the state it is judging, and two of the ten types draw from the random stream.
Parameters
blocks
state
position
random
Returns
boolean
RuleTestTypeName
RuleTestTypeName =
"always_true"|"block_match"|"blockstate_match"|"tag_match"|"random_block_match"|"random_blockstate_match"|"height_match"|"not"|"any_of"|"all_of"
Defined in: features/ruleTest.ts:21
The ten types Java 26.3 registers in rule_test.
TemplateProcessors
TemplateProcessors =
string| {processors: readonlyunknown[]; }
Defined in: world/FeatureWorld.ts:197
The processors a feature runs its template through.
Java's field is either an identifier naming a worldgen/processor_list or the list itself, written where the feature stands. The inline form stays unknown here, because this package names a chain and does not read one. The world parses whichever form arrives.
VerticalAnchor
VerticalAnchor = {
kind:"absolute";y:number; } | {kind:"above_bottom";offset:number; } | {kind:"below_top";offset:number; } | {kind:"relative_to_sea_level";offset:number; }
Defined in: providers/heightProvider.ts:30
One end of a vertical range, Java's VerticalAnchor.
The four forms exist so a datapack can express "eight above the bottom of whatever dimension this is" without knowing the dimension's height.
VerticalDirection
VerticalDirection =
"down"|"up"
Defined in: world/BlockState.ts:23
The two vertical directions, which environment_scan and the speleothem features search along.
WorldgenRandomAlgorithm
WorldgenRandomAlgorithm =
"xoroshiro"|"legacy"
Defined in: placement/WorldgenRandom.ts:11
Which generator backs a WorldgenRandom. The decoration pass uses Xoroshiro.
Variables
AIR
constAIR:BlockState
Defined in: world/TestFeatureWorld.ts:7
The state every unwritten position holds.
ALL_DIRECTIONS
constALL_DIRECTIONS: readonly ["down","up","north","south","west","east"]
Defined in: world/BlockState.ts:45
Every direction in Java's declaration order, which decides iteration order in several features.
BIOME_INFO_NOISE
constBIOME_INFO_NOISE:SimplexNoise
Defined in: placement/modifiers.ts:25
The noise Java samples for noise_based_count and noise_threshold_count.
It is Biome.BIOME_INFO_NOISE: one simplex octave seeded from 2345 with its coordinate offsets discarded, shared by every world regardless of seed. That is why a flower field sits in the same place in every world, and it is the one part of the decoration pass that is not keyed off the world seed at all.
DECORATION_STEPS
constDECORATION_STEPS: readonly ["raw_generation","lakes","local_modifications","underground_structures","surface_structures","strongholds","underground_ores","underground_decoration","fluid_springs","vegetal_decoration","top_layer_modification"]
Defined in: placement/pipeline.ts:17
The eleven decoration steps, in the order Java runs them.
The order is part of the world's contract rather than a detail: lakes carve before local modifications fill them, ores cut through both, and vegetation lands on whatever the earlier steps left. A biome's features field is a list of eleven lists in exactly this order.
DIRECTION_STEPS
constDIRECTION_STEPS:Readonly<Record<Direction, readonly [number,number,number]>>
Defined in: world/BlockState.ts:26
The unit step of each direction, in Java's axis order.
FEATURE_TYPES
constFEATURE_TYPES: readonly ["bamboo","block_blob","block_column","block_pile","blue_ice","bonus_chest","chorus_plant","coral_claw","coral_tree","delta_feature","disk","end_gateway","end_island","end_platform","end_podium","end_spike","fallen_tree","fill_layer","fossil","freeze_top_layer","geode","huge_brown_mushroom","huge_fungus","huge_red_mushroom","iceberg","lake","large_dripstone","monster_room","multiface_growth","netherrack_replace_blobs","no_op","ore","overlay","projected_random_patchy_square","random_boolean_selector","random_neighbor_spread","random_selector","replace_single_block","root_system","scattered_ore","sculk_patch","sequence","simple_block","simple_random_selector","single_block_pillar","speleothem","speleothem_cluster","spike","spring_feature","stepped_column_cluster","template","tree","underwater_magma","vegetation_patch","vines","void_start_platform","waterlogged_vegetation_patch","weighted_random_selector"]
Defined in: features/Feature.ts:6
The 58 feature types Java 26.3 registers in worldgen/feature_type.
HORIZONTAL_DIRECTIONS
constHORIZONTAL_DIRECTIONS: readonly ["north","east","south","west"]
Defined in: world/BlockState.ts:42
The four compass directions in Java's Direction.Plane.HORIZONTAL order.
This is north, east, south, west, which is not the order of Direction.values(). Anything that draws a random horizontal direction indexes into this array, so the order is part of the seed contract rather than a presentation detail.
alwaysTrue
constalwaysTrue:BlockPredicate
Defined in: providers/blockPredicate.ts:39
The predicate that accepts everything, which several optional fields default to.
noOpFeature
constnoOpFeature:ConfiguredFeature
Defined in: features/Feature.ts:99
The feature that does nothing, which selectors use as a weighted "place nothing" branch.
structuralInternals
conststructuralInternals:object
Defined in: features/structural.ts:1705
Exported for the corpus test, which reports how many states a geode's inner placements hold.
Type Declaration
mthCos
mthCos: (
value) =>number
Java's Mth.cos, the same table a quarter turn along.
Parameters
value
number
Returns
number
mthSin
mthSin: (
value) =>number
Java's Mth.sin, which reads a 65536-entry float table rather than calling Math.sin.
The two differ by up to about 5e-5, which is enough to move an ore vein's sphere radii across a block boundary, so worldgen code that calls Mth.sin has to call this and code that calls java.lang.Math.sin has to call Math.sin.
Parameters
value
number
Returns
number
PACKED_ICE
PACKED_ICE:
BlockState
parseStateList
parseStateList: (
source,path) =>BlockState[]
Parameters
source
unknown
path
string
Returns
treeInternals
consttreeInternals:object
Defined in: features/tree.ts:135
Exposed for the sibling fallen_tree feature, which reuses the trunk and decorator parsers.
Type Declaration
constantInt
constantInt: (
value) =>IntProvider
A constant. Costs no draws.
Parameters
value
number
Returns
parseTreeDecorator
parseTreeDecorator: (
source,path,parsers) =>TreeDecorator
Parses one decorators entry into the matching decorator.
Parameters
source
unknown
path
string
parsers
Returns
parseTrunkPlacer
parseTrunkPlacer: (
source,path) =>TrunkPlacer
Parses a trunk_placer body into the matching placer.
Parameters
source
unknown
path
string
Returns
placeLog
placeLog: (
context,position,modify) =>boolean
Places a trunk block from the trunk provider where the tree may grow; returns whether it did.
Parameters
context
position
modify?
(state) => BlockState
Returns
boolean
validTreePos
validTreePos: (
world,position) =>boolean
Answers Java's TreeFeature.validTreePos: air, or a block trees are allowed to grow through.
Parameters
world
position
Returns
boolean
Functions
above()
above(
position,distance?):BlockPos
Defined in: features/support.ts:16
Returns the position one block up.
Parameters
position
distance?
number = 1
Returns
asArray()
asArray(
value,path):unknown[]
Defined in: json.ts:25
Reads a JSON array.
Parameters
value
unknown
path
string
Returns
unknown[]
asBoolean()
asBoolean(
value,path,fallback?):boolean
Defined in: json.ts:47
Reads a boolean, with an optional fallback for a missing field.
Parameters
value
unknown
path
string
fallback?
boolean
Returns
boolean
asEnum()
asEnum<
T>(value,allowed,path):T
Defined in: json.ts:61
Reads a string that must be one of a known set, narrowing it to that union.
Type Parameters
T
T extends string
Parameters
value
unknown
allowed
readonly T[]
path
string
Returns
T
asInteger()
asInteger(
value,path,fallback?):number
Defined in: json.ts:40
Reads an integer, with an optional fallback for a missing field.
Parameters
value
unknown
path
string
fallback?
number
Returns
number
asNumber()
asNumber(
value,path,fallback?):number
Defined in: json.ts:31
Reads a finite number, with an optional fallback for a missing field.
Parameters
value
unknown
path
string
fallback?
number
Returns
number
asObject()
asObject(
value,path):Record<string,unknown>
Defined in: json.ts:16
Reads a JSON object.
Parameters
value
unknown
path
string
Returns
Record<string, unknown>
asString()
asString(
value,path,fallback?):string
Defined in: json.ts:54
Reads a string, with an optional fallback for a missing field.
Parameters
value
unknown
path
string
fallback?
string
Returns
string
atY()
atY(
origin,y):BlockPos
Defined in: world/FeatureWorld.ts:21
Returns origin with a different y.
Parameters
origin
y
number
Returns
bamboo()
bamboo(
probability):ConfiguredFeature
Defined in: features/structural.ts:774
A bamboo stalk with its podzol disc, Java's bamboo.
Parameters
probability
number
Returns
below()
below(
position,distance?):BlockPos
Defined in: features/support.ts:19
Returns the position one block down.
Parameters
position
distance?
number = 1
Returns
betweenClosed()
betweenClosed(
from,to):Generator<BlockPos>
Defined in: features/support.ts:58
Iterates every position of an inclusive box, in Java's BlockPos.betweenClosed order.
Parameters
from
to
Returns
Generator<BlockPos>
biasedToBottomHeight()
biasedToBottomHeight(
min,max,inner):HeightProvider
Defined in: providers/heightProvider.ts:106
A y weighted toward the bottom of [min + inner, max]. Costs two draws.
Parameters
min
max
inner
number
Returns
biasedToBottomInt()
biasedToBottomInt(
min,max):IntProvider
Defined in: providers/valueProviders.ts:60
A value in [min, max] weighted toward min. Costs two draws.
Parameters
min
number
max
number
Returns
biomeFilter()
biomeFilter():
PlacementModifier
Defined in: placement/modifiers.ts:157
Keeps the position when the placed feature is listed for the biome there.
Java throws when a feature reaches this modifier without having been looked up through a biome, because placing it anyway would ignore the biome's own list. This reproduces that: a context with no biome table accepts everything, and the chunk generator always supplies one.
Returns
blockBlob()
blockBlob(
state,canPlaceOn):ConfiguredFeature
Defined in: features/simple.ts:444
Drops three overlapping blobs of one state onto the first block that passes a predicate.
Parameters
state
canPlaceOn
Returns
blockColumn()
blockColumn(
layers,direction,allowedPlacement,prioritizeTip):ConfiguredFeature
Defined in: features/simple.ts:728
Stacks several bands of blocks in one direction, trimming them when the column runs into something.
Which end gets trimmed is prioritize_tip: a twisting vine keeps its tip and loses its stem, while a kelp column keeps its stem and loses its tip.
Parameters
layers
readonly BlockColumnLayer[]
direction
allowedPlacement
prioritizeTip
boolean
Returns
blockPile()
blockPile(
stateProvider):ConfiguredFeature
Defined in: features/simple.ts:416
Scatters blocks over a small disc of ground, thinning toward the edge.
Parameters
stateProvider
Returns
blockPosHashCode()
blockPosHashCode(
position):number
Defined in: features/javaHashSet.ts:4
Java's BlockPos.hashCode().
Parameters
position
Returns
number
blockPredicateFilter()
blockPredicateFilter(
predicate):PlacementModifier
Defined in: placement/modifiers.ts:161
Keeps the position when a block predicate holds there.
Parameters
predicate
Returns
blockState()
blockState(
name,properties?):BlockState
Defined in: world/BlockState.ts:62
Builds a block state, sharing one frozen object for the common property-free case.
Parameters
name
string
properties?
Readonly<Record<string, string>>
Returns
blockStateKey()
blockStateKey(
state):string
Defined in: world/BlockState.ts:81
Returns the canonical text form, minecraft:oak_log[axis=y], with properties in sorted order.
Two states are the same state when their keys are equal, which is what the feature code compares instead of walking property maps.
Parameters
state
Returns
string
blueIce()
blueIce():
ConfiguredFeature
Defined in: features/simple.ts:177
Grows a patch of blue ice underwater beside packed ice.
Returns
bonusChest()
bonusChest():
ConfiguredFeature
Defined in: features/structural.ts:569
The bonus chest, Java's bonus_chest.
Returns
chorusPlant()
chorusPlant():
ConfiguredFeature
Defined in: features/structural.ts:873
A chorus plant, Java's chorus_plant.
Java delegates to ChorusFlowerBlock.generatePlant, which is block behavior rather than world generation. This places the flower and reports success; the growth pass belongs to the server's block layer, which is recorded in the README.
Returns
clampedInt()
clampedInt(
source,min,max):IntProvider
Defined in: providers/valueProviders.ts:111
Clamps another provider's draw into [min, max]. Costs whatever the source costs.
Parameters
source
min
number
max
number
Returns
clampedNormalFloat()
clampedNormalFloat(
mean,deviation,min,max):FloatProvider
Defined in: providers/valueProviders.ts:252
A normal distribution truncated into [min, max].
Parameters
mean
number
deviation
number
min
number
max
number
Returns
clampedNormalInt()
clampedNormalInt(
mean,deviation,min,max):IntProvider
Defined in: providers/valueProviders.ts:119
A normal distribution truncated into [min, max]. Costs the gaussian's draws.
Parameters
mean
number
deviation
number
min
number
max
number
Returns
constantFloat()
constantFloat(
value):FloatProvider
Defined in: providers/valueProviders.ts:222
A constant. Costs no draws.
Parameters
value
number
Returns
constantHeight()
constantHeight(
value):HeightProvider
Defined in: providers/heightProvider.ts:85
A fixed anchor. Costs no draws.
Parameters
value
Returns
constantInt()
constantInt(
value):IntProvider
Defined in: providers/valueProviders.ts:41
A constant. Costs no draws.
Parameters
value
number
Returns
copyPropertiesProvider()
copyPropertiesProvider(
source):BlockStateProvider
Defined in: providers/blockStateProvider.ts:201
Draws a source state, then overwrites its properties with the ones the world block declares.
Parameters
source
Returns
coralClaw()
coralClaw(
block):ConfiguredFeature
Defined in: features/structural.ts:925
A coral claw, Java's coral_claw.
Parameters
block
Returns
coralTree()
coralTree(
block):ConfiguredFeature
Defined in: features/structural.ts:882
A coral tree, Java's coral_tree.
Parameters
block
Returns
countOnEveryLayer()
countOnEveryLayer(
count):PlacementModifier
Defined in: placement/modifiers.ts:227
Places count positions on every exposed floor in the column, working downward.
Java marks this deprecated and only the nether's vegetation still uses it. It keeps raising the layer index until a pass finds nothing, so the number of draws depends on the terrain.
Parameters
count
Returns
countPlacement()
countPlacement(
count):PlacementModifier
Defined in: placement/modifiers.ts:104
Repeats the origin a drawn number of times.
Parameters
count
Returns
createTestOracle()
createTestOracle(
tables?):BlockOracle
Defined in: world/TestFeatureWorld.ts:34
Builds a BlockOracle from plain tables.
A test declares only the blocks it cares about; everything unnamed is a solid, unreplaceable, untagged block, which is what a feature placed into stone sees.
Parameters
tables?
TestOracleTables = {}
Returns
cuboidPlacement()
cuboidPlacement(
xzSize,ySize,includeEdges,includeInterior):PlacementModifier
Defined in: placement/modifiers.ts:286
Emits every position of a box anchored at the origin, optionally hollow or shell-free.
Parameters
xzSize
ySize
includeEdges
boolean
includeInterior
boolean
Returns
decorateChunk()
decorateChunk(
scheduled,context,levelSeed,chunkX,chunkZ):DecorationResult
Defined in: placement/pipeline.ts:161
Runs a chunk's whole decoration pass.
This is the entry point a chunk generator calls. It derives the population seed once, then reseeds the stream before each feature from that seed, the feature's index and its step, so every feature is independent of how many draws the ones before it made. Running the same plan against the same seed and chunk twice produces the same blocks, and running a subset of the plan does not move the rest.
Parameters
scheduled
readonly ScheduledFeature[]
The plan, which orderDecoration puts in Java's order.
context
levelSeed
bigint
The world seed.
chunkX
number
The chunk's x coordinate, not a block coordinate.
chunkZ
number
The chunk's z coordinate.
Returns
decorationStepIndex()
decorationStepIndex(
step):number
Defined in: placement/pipeline.ts:35
Returns a step's ordinal, which the feature seed derivation multiplies by 10000.
Parameters
step
"lakes" | "raw_generation" | "local_modifications" | "underground_structures" | "surface_structures" | "strongholds" | "underground_ores" | "underground_decoration" | "fluid_springs" | "vegetal_decoration" | "top_layer_modification"
Returns
number
deltaFeature()
deltaFeature(
contents,rim,size,rimSize):ConfiguredFeature
Defined in: features/simple.ts:511
Pours a lava delta with an offset rim over the basalt deltas floor.
Parameters
contents
rim
size
rimSize
Returns
disk()
disk(
stateProvider,target,radius,halfHeight):ConfiguredFeature
Defined in: features/simple.ts:555
Lays a flat disc of blocks wherever a target predicate holds, within a drawn radius.
Parameters
stateProvider
target
radius
halfHeight
number
Returns
distanceSquared()
distanceSquared(
a,b):number
Defined in: features/support.ts:131
The squared Euclidean distance between two positions.
Parameters
a
b
Returns
number
dualNoiseProvider()
dualNoiseProvider(
slowNoise,slowScale,varietyMin,varietyMax,noise,scale,states):BlockStateProvider
Defined in: providers/blockStateProvider.ts:94
Picks a varying subset of the states with a slow noise, then indexes that subset with the fast one. Costs no draws.
Java samples the slow noise once per candidate at a position shifted by a large constant, which is why the subset is stable across a region rather than per block.
Parameters
slowNoise
slowScale
number
varietyMin
number
varietyMax
number
noise
scale
number
states
readonly BlockState[]
Returns
endGateway()
endGateway(
exit,exact):ConfiguredFeature
Defined in: features/structural.ts:1015
An end gateway, Java's end_gateway.
Parameters
exit
BlockPos | undefined
exact
boolean
Returns
endIsland()
endIsland():
ConfiguredFeature
Defined in: features/structural.ts:970
A floating end island, Java's end_island.
Returns
endPlatform()
endPlatform():
ConfiguredFeature
Defined in: features/simple.ts:256
Builds the five by five obsidian platform an arrival in the end lands on.
Returns
endPodium()
endPodium(
active):ConfiguredFeature
Defined in: features/structural.ts:986
The exit portal's bedrock podium, Java's end_podium.
Parameters
active
boolean
Returns
endSpike()
endSpike(
spikes,crystalInvulnerable,crystalBeamTarget):ConfiguredFeature
Defined in: features/structural.ts:1049
The obsidian pillars of the end, Java's end_spike.
An empty spikes list means "derive the ten pillars from the world seed", which is what the vanilla configured feature ships; only the respawn animation passes explicit spikes.
Parameters
spikes
readonly EndSpike[]
crystalInvulnerable
boolean
crystalBeamTarget
BlockPos | undefined
Returns
endSpikesForSeed()
endSpikesForSeed(
seed): readonlyEndSpike[]
Defined in: features/endSpikes.ts:31
Derives the ten spike pillars from the world seed, Java's EndSpikeFeature.getSpikesForLevel and SpikeCacheLoader.load.
Java reduces the seed to a 16-bit cache key, new LegacyRandom(seed).nextLong() & 65535, then shuffles the indices 0 through 9 with a second generator seeded by that key. Pillar i sits at floor(42 * cos(2 * (-PI + 0.3141592653589793 * i))) by the matching sine, and its shuffled index n shapes it: radius 2 + n / 3, height 76 + 3 * n, an iron-bar cage when n is 1 or 2.
Parameters
seed
bigint
Returns
readonly EndSpike[]
The ten pillars in Java's order, counterclockwise from (42, 0).
environmentScan()
environmentScan(
directionOfSearch,targetCondition,allowedSearchCondition,maxSteps):PlacementModifier
Defined in: placement/modifiers.ts:258
Walks up or down looking for a position that satisfies a predicate.
The scan stops at the first target hit, at the world edge, or when the search condition stops holding, and it tests the target once more after the final step, which is how a scan of max_steps can land one block past its last move.
Parameters
directionOfSearch
targetCondition
allowedSearchCondition
maxSteps
number
Returns
fail()
fail(
path,message):never
Defined in: json.ts:11
Raises a parse error naming the JSON path that failed.
Parameters
path
string
message
string
Returns
never
fallenTree()
fallenTree(
trunkProvider,logLength,stumpDecorators,logDecorators):ConfiguredFeature
Defined in: features/structural.ts:1344
A fallen log with its stump, Java's fallen_tree.
Parameters
trunkProvider
logLength
stumpDecorators
readonly TreeDecorator[]
logDecorators
readonly TreeDecorator[]
Returns
feature()
feature(
type,place,children?):ConfiguredFeature
Defined in: features/Feature.ts:92
Builds a ConfiguredFeature from a placement function.
Parameters
type
"sequence" | "bamboo" | "block_blob" | "block_column" | "block_pile" | "blue_ice" | "bonus_chest" | "chorus_plant" | "coral_claw" | "coral_tree" | "delta_feature" | "disk" | "end_gateway" | "end_island" | "end_platform" | "end_podium" | "end_spike" | "fallen_tree" | "fill_layer" | "fossil" | "freeze_top_layer" | "geode" | "huge_brown_mushroom" | "huge_fungus" | "huge_red_mushroom" | "iceberg" | "lake" | "large_dripstone" | "monster_room" | "multiface_growth" | "netherrack_replace_blobs" | "no_op" | "ore" | "overlay" | "projected_random_patchy_square" | "random_boolean_selector" | "random_neighbor_spread" | "random_selector" | "replace_single_block" | "root_system" | "scattered_ore" | "sculk_patch" | "simple_block" | "simple_random_selector" | "single_block_pillar" | "speleothem" | "speleothem_cluster" | "spike" | "spring_feature" | "stepped_column_cluster" | "template" | "tree" | "underwater_magma" | "vegetation_patch" | "vines" | "void_start_platform" | "waterlogged_vegetation_patch" | "weighted_random_selector"
place
(world, random, origin) => boolean
children?
readonly ConfiguredFeature[]
Returns
fillLayer()
fillLayer(
height,state):ConfiguredFeature
Defined in: features/simple.ts:162
Fills one y level of the chunk with a state, wherever that level is air.
Parameters
height
number
state
Returns
fixedPlacement()
fixedPlacement(
positions):PlacementModifier
Defined in: placement/modifiers.ts:324
Emits the listed absolute positions that fall in the origin's chunk.
Parameters
positions
readonly BlockPos[]
Returns
fossil()
fossil(
fossilStructures,overlayStructures,fossilProcessors,overlayProcessors,maxEmptyCornersAllowed):ConfiguredFeature
Defined in: features/structural.ts:628
Buries a fossil, Java's fossil.
Parameters
fossilStructures
readonly string[]
overlayStructures
readonly string[]
fossilProcessors
string
overlayProcessors
string
maxEmptyCornersAllowed
number
Returns
freezeTopLayer()
freezeTopLayer():
ConfiguredFeature
Defined in: features/simple.ts:391
Freezes exposed water and lays a snow layer across the chunk.
Java decides both from the biome's temperature at the position and from the block light there. Temperature comes through import('../world/FeatureWorld').FeatureWorld.isColdEnoughToSnow and light is taken as dark, which is what a chunk being generated has everywhere but under a light-emitting block.
Returns
geode()
geode(
config):ConfiguredFeature
Defined in: features/structural.ts:107
An amethyst geode, Java's geode.
It is a metaball field: several points are scattered inside the origin's neighborhood, and every block in the generation box sums the inverse square roots of its distances to them. Four thresholds on that sum cut the sum into the four shells, and a second field of three points cuts the crack through them.
Parameters
config
Returns
heightRange()
heightRange(
height):PlacementModifier
Defined in: placement/modifiers.ts:134
Replaces the position's y with a draw from a height provider.
Parameters
height
Returns
heightmapPlacement()
heightmapPlacement(
heightmap):PlacementModifier
Defined in: placement/modifiers.ts:142
Moves the position to the top of a heightmap column, dropping it when the column is empty.
Parameters
heightmap
Returns
hugeBrownMushroom()
hugeBrownMushroom(
config):ConfiguredFeature
Defined in: features/structural.ts:1202
The brown mushroom's flat cap, Java's huge_brown_mushroom.
Parameters
config
Returns
hugeFungus()
hugeFungus(
validBaseState,stemState,hatState,decorState,replaceableBlocks,planted):ConfiguredFeature
Defined in: features/structural.ts:1234
A huge nether fungus, Java's huge_fungus.
Parameters
validBaseState
stemState
hatState
decorState
replaceableBlocks
planted
boolean
Returns
hugeRedMushroom()
hugeRedMushroom(
config):ConfiguredFeature
Defined in: features/structural.ts:1170
The red mushroom's domed cap, Java's huge_red_mushroom.
Parameters
config
Returns
iceberg()
iceberg(
state):ConfiguredFeature
Defined in: features/structural.ts:323
An iceberg, Java's iceberg.
Parameters
state
Returns
inBlockSet()
inBlockSet(
blocks,state,set):boolean
Defined in: features/support.ts:123
Answers whether a state is in a parsed HolderSet<Block>.
Parameters
blocks
state
set
Returns
boolean
inSquare()
inSquare():
PlacementModifier
Defined in: placement/modifiers.ts:116
Scatters the position uniformly across the chunk's 16 by 16 footprint, keeping its y.
Returns
isBlock()
isBlock(
state,name):boolean
Defined in: world/BlockState.ts:88
Answers whether two states name the same block, ignoring their properties.
Parameters
state
name
string
Returns
boolean
isEmptyBlock()
isEmptyBlock(
world,position):boolean
Defined in: features/support.ts:22
Answers Java's LevelAccessor.isEmptyBlock.
Parameters
world
position
Returns
boolean
isOutsideBuildHeight()
isOutsideBuildHeight(
world,y):boolean
Defined in: world/FeatureWorld.ts:220
Answers whether y is outside the dimension's generated range.
Parameters
world
y
number
Returns
boolean
lake()
lake(
fluid,barrier,canPlaceFeature,canReplaceWithAirOrFluid,canReplaceWithBarrier):ConfiguredFeature
Defined in: features/structural.ts:221
A lake, Java's lake.
The shape is drawn into a 16 by 8 by 16 boolean grid by four to seven overlapping ellipsoids, checked against the world, and then written twice: fluid below y offset 4 and cave air above it, then a barrier shell around whatever that touched.
Parameters
fluid
barrier
canPlaceFeature
canReplaceWithAirOrFluid
canReplaceWithBarrier
Returns
largeDripstone()
largeDripstone(
config):ConfiguredFeature
Defined in: features/caves.ts:432
The cave-spanning dripstone cone pair, Java's large_dripstone.
Parameters
config
Returns
manhattan()
manhattan(
a,b):number
Defined in: features/support.ts:127
The Manhattan distance between two positions.
Parameters
a
b
Returns
number
monsterRoom()
monsterRoom():
ConfiguredFeature
Defined in: features/structural.ts:488
The dungeon, Java's monster_room.
Returns
mthCos()
mthCos(
value):number
Defined in: features/support.ts:120
Java's Mth.cos, the same table a quarter turn along.
Parameters
value
number
Returns
number
mthSin()
mthSin(
value):number
Defined in: features/support.ts:117
Java's Mth.sin, which reads a 65536-entry float table rather than calling Math.sin.
The two differ by up to about 5e-5, which is enough to move an ore vein's sphere radii across a block boundary, so worldgen code that calls Mth.sin has to call this and code that calls java.lang.Math.sin has to call Math.sin.
Parameters
value
number
Returns
number
multifaceGrowth()
multifaceGrowth(
placeBlock,searchRange,canPlaceOnFloor,canPlaceOnCeiling,canPlaceOnWall,canBePlacedOn):ConfiguredFeature
Defined in: features/simple.ts:656
Grows a face-attached block such as glow lichen or sculk vein onto a nearby surface.
Java then rolls chance_of_spreading and, when it passes, asks the block's own spreader to continue from the placed face. The spreader is block behavior rather than world generation, so this places the first face and stops; the README records the spread pass as the caller's job. The roll is still drawn, because it costs one float whichever way it lands, and the chance itself therefore does not reach this function.
Parameters
placeBlock
string
searchRange
number
canPlaceOnFloor
boolean
canPlaceOnCeiling
boolean
canPlaceOnWall
boolean
canBePlacedOn
Returns
netherrackReplaceBlobs()
netherrackReplaceBlobs(
target,replacement,radius):ConfiguredFeature
Defined in: features/simple.ts:469
Finds the nearest target block below and replaces a Manhattan blob of it.
Parameters
target
replacement
radius
Returns
nextDoubleBetween()
nextDoubleBetween(
random,min,max):number
Defined in: placement/WorldgenRandom.ts:240
Returns a double in [min, max), as Java's Mth.nextDouble does.
Parameters
random
min
number
max
number
Returns
number
nextFloatBetween()
nextFloatBetween(
random,min,max):number
Defined in: placement/WorldgenRandom.ts:236
Returns a float in [min, max) collapsed to min when inverted, as Mth.nextFloat does.
Parameters
random
min
number
max
number
Returns
number
nextIntBetween()
nextIntBetween(
random,min,max):number
Defined in: placement/WorldgenRandom.ts:228
Returns an integer in [min, max], collapsing an inverted range to min, as Mth.nextInt does.
Parameters
random
min
number
max
number
Returns
number
noOp()
noOp():
ConfiguredFeature
Defined in: features/simple.ts:52
Builds the no_op feature, which Java reports as a successful placement that wrote nothing.
Returns
noiseBasedCount()
noiseBasedCount(
noiseToCountRatio,noiseFactor,noiseOffset):PlacementModifier
Defined in: placement/modifiers.ts:190
Repeats the origin a number of times scaled from the shared biome-info noise.
Parameters
noiseToCountRatio
number
noiseFactor
number
noiseOffset
number
Returns
noiseProvider()
noiseProvider(
noise,scale,states):BlockStateProvider
Defined in: providers/blockStateProvider.ts:72
Indexes a state list by a normal noise sampled at the position. Costs no draws.
It is positional rather than random, which is what makes a noise-picked flower field look like patches instead of static.
Parameters
noise
scale
number
states
readonly BlockState[]
Returns
noiseThresholdCount()
noiseThresholdCount(
noiseLevel,belowNoise,aboveNoise):PlacementModifier
Defined in: placement/modifiers.ts:184
Repeats the origin a number of times read from the shared biome-info noise.
Parameters
noiseLevel
number
belowNoise
number
aboveNoise
number
Returns
noiseThresholdProvider()
noiseThresholdProvider(
noise,scale,threshold,highChance,defaultState,lowStates,highStates):BlockStateProvider
Defined in: providers/blockStateProvider.ts:115
Splits on a noise threshold, then draws uniformly from one side. Costs up to two draws.
Parameters
noise
scale
number
threshold
number
highChance
number
defaultState
lowStates
readonly BlockState[]
highStates
readonly BlockState[]
Returns
normal()
normal(
random,mean,deviation):number
Defined in: placement/WorldgenRandom.ts:244
Returns a normally distributed float, as Java's Mth.normal does.
Parameters
random
mean
number
deviation
number
Returns
number
normalizeIdentifier()
normalizeIdentifier(
value,path):string
Defined in: registry.ts:11
Expands a registry reference to its namespace:path form.
Mojang's data leaves minecraft off in some places and spells it out in others, so every lookup goes through here first.
Parameters
value
unknown
path
string
Returns
string
offset()
offset(
origin,dx,dy,dz):BlockPos
Defined in: world/FeatureWorld.ts:14
Returns origin moved by a delta.
Parameters
origin
dx
number
dy
number
dz
number
Returns
offsetPlacement()
offsetPlacement(
x,y,z):PlacementModifier
Defined in: placement/modifiers.ts:126
Moves the position by a drawn offset on each axis, in x, y, z draw order.
Parameters
x
y
z
Returns
oppositeDirection()
oppositeDirection<
D>(direction):object[D]
Defined in: world/BlockState.ts:57
Returns the direction facing the other way.
Type Parameters
D
D extends Direction
Parameters
direction
D
Returns
object[D]
orderDecoration()
orderDecoration(
scheduled):ScheduledFeature[]
Defined in: placement/pipeline.ts:116
Sorts a decoration plan into Java's execution order: step first, then index within the step.
Parameters
scheduled
readonly ScheduledFeature[]
Returns
ore()
ore(
targets,size,discardChanceOnAirExposure):ConfiguredFeature
Defined in: features/ore.ts:56
The vein-shaped ore, Java's OreFeature.
It draws a line through the origin at a random horizontal angle, hangs size spheres along it with radii that swell toward the middle, discards spheres swallowed by their neighbors, and fills the union. The distinctive part is that the discard pass runs before any block is written, so the vein's shape is decided entirely by size and four draws.
Parameters
targets
readonly BlockReplacement[]
size
number
discardChanceOnAirExposure
number
Returns
outsideBuildHeight()
outsideBuildHeight(
world,y):boolean
Defined in: features/support.ts:54
Answers whether a y is outside the generated range.
Parameters
world
y
number
Returns
boolean
overlay()
overlay(
features):ConfiguredFeature
Defined in: features/simple.ts:108
Runs every placed feature at the same origin, reporting whether any placed.
Parameters
features
readonly PlacedFeature[]
Returns
parseBlockPredicate()
parseBlockPredicate(
source,path):BlockPredicate
Defined in: providers/blockPredicate.ts:80
Reads a block_predicate_type document.
matching_blocks, matching_fluids and matching_biomes accept a #tag reference as well as a list, which this resolves through FeatureWorld.blocks rather than at parse time, so a predicate stays usable when tag data changes.
Parameters
source
unknown
path
string
Returns
parseBlockReplacement()
parseBlockReplacement(
source,path):BlockReplacement
Defined in: features/ruleTest.ts:107
Reads a {"target": ..., "state": ...} replacement.
Parameters
source
unknown
path
string
Returns
parseBlockReplacements()
parseBlockReplacements(
source,path):BlockReplacement[]
Defined in: features/ruleTest.ts:116
Reads the list of replacements an ore or a replace_single_block carries.
Parameters
source
unknown
path
string
Returns
parseBlockSet()
parseBlockSet(
source,path):BlockSet
Defined in: registry.ts:40
Reads a HolderSet<Block>: a tag reference, one identifier, or an inline list of them.
Parameters
source
unknown
path
string
Returns
parseBlockState()
parseBlockState(
source,path):BlockState
Defined in: providers/blockStateProvider.ts:219
Reads a block state.
26.3 accepts a bare identifier wherever a state is expected, which is how most of the feature data spells a block with no interesting properties.
Parameters
source
unknown
path
string
Returns
parseBlockStateProvider()
parseBlockStateProvider(
source,path,resolve?):BlockStateProvider
Defined in: providers/blockStateProvider.ts:254
Reads a worldgen/block_state_provider_type document.
Three spellings are accepted, because 26.3 accepts all three: a bare identifier is a reference into the block_state_provider registry, which vanilla uses for the eight shared providers such as soil_beneath_tree; a bare {"id": ...} object or a bare identifier string in a state position is a simple provider; and an object with a type is a typed provider.
Parameters
source
unknown
path
string
resolve?
Returns
parseCaveFeature()
parseCaveFeature(
type,raw,path,parsers):ConfiguredFeature|undefined
Defined in: features/caves.ts:801
Reads the cave feature types.
Parameters
type
string
raw
Record<string, unknown>
path
string
parsers
Returns
ConfiguredFeature | undefined
parseDirection()
parseDirection(
value,path):Direction
Defined in: providers/blockPredicate.ts:218
Reads a Direction.
Parameters
value
unknown
path
string
Returns
parseFloatProvider()
parseFloatProvider(
source,path):FloatProvider
Defined in: providers/valueProviders.ts:260
Reads a FloatProvider. A bare number is a constant.
Parameters
source
unknown
path
string
Returns
parseHeightProvider()
parseHeightProvider(
source,path):HeightProvider
Defined in: providers/heightProvider.ts:152
Reads a HeightProvider. A bare anchor object is a constant.
Parameters
source
unknown
path
string
Returns
parseIntProvider()
parseIntProvider(
source,path):IntProvider
Defined in: providers/valueProviders.ts:148
Reads an IntProvider.
A bare number is a constant, which is how most of the data spells a fixed count.
Parameters
source
unknown
path
string
Returns
parseOreFeature()
parseOreFeature(
type,raw,path):ConfiguredFeature|undefined
Defined in: features/ore.ts:205
Reads the two ore feature types, which share a configuration shape.
Parameters
type
string
raw
Record<string, unknown>
path
string
Returns
ConfiguredFeature | undefined
parsePlacedFeature()
parsePlacedFeature(
source,path,resolveFeature):PlacedFeature
Defined in: placement/pipeline.ts:123
Reads a worldgen/placed_feature document, resolving its feature reference.
Parameters
source
unknown
path
string
resolveFeature
(value, path) => ConfiguredFeature
Returns
parsePlacementModifier()
parsePlacementModifier(
source,path):PlacementModifier
Defined in: placement/modifiers.ts:347
Reads one worldgen/placement_modifier_type document.
Parameters
source
unknown
path
string
Returns
parseRuleTest()
parseRuleTest(
source,path):RuleTest
Defined in: features/ruleTest.ts:34
Reads a rule_test document. The dispatch key is predicate_type, not type.
Parameters
source
unknown
path
string
Returns
parseSimpleFeature()
parseSimpleFeature(
type,raw,path,parsers):ConfiguredFeature|undefined
Defined in: features/simple.ts:811
Reads the simple feature types, given the parsers for the nested documents they carry.
Parameters
type
string
raw
Record<string, unknown>
path
string
parsers
Returns
ConfiguredFeature | undefined
parseStructuralFeature()
parseStructuralFeature(
type,raw,path,parsers):ConfiguredFeature|undefined
Defined in: features/structural.ts:1434
Reads the structural feature types.
Parameters
type
string
raw
Record<string, unknown>
path
string
parsers
Returns
ConfiguredFeature | undefined
parseTreeConfig()
parseTreeConfig(
raw,path,parsers):TreeConfig
Defined in: features/tree/parse.ts:300
Reads a minecraft:tree configuration.
Parameters
raw
Record<string, unknown>
path
string
parsers
Returns
parseTreeFeature()
parseTreeFeature(
type,raw,path,parsers):ConfiguredFeature|undefined
Defined in: features/tree.ts:127
Reads the tree feature type.
Parameters
type
string
raw
Record<string, unknown>
path
string
parsers
Returns
ConfiguredFeature | undefined
parseVerticalAnchor()
parseVerticalAnchor(
source,path):VerticalAnchor
Defined in: providers/heightProvider.ts:51
Reads a VerticalAnchor, which is an object with exactly one of the four keys.
Parameters
source
unknown
path
string
Returns
parseWeightedList()
parseWeightedList<
T>(source,path,parseEntry):Weighted<T>[]
Defined in: providers/valueProviders.ts:296
Reads a Java WeightedList, which is a list of {data, weight} entries.
The declared order is kept, because randomWeighted walks it and a reordering would change which entry a given draw selects.
Type Parameters
T
T
Parameters
source
unknown
path
string
parseEntry
(value, path) => T
Returns
Weighted<T>[]
placeFeature()
placeFeature(
placed,context,random,origin):boolean
Defined in: placement/pipeline.ts:60
Runs a placed feature's modifier chain and places the feature at every position it yields.
The traversal is Java's, and it is depth first rather than stage by stage: the first position a modifier emits runs all the way to the end of the chain before the second one starts. That decides the order of the random draws, so a breadth-first version with the same modifiers produces a different world from the same seed.
Parameters
placed
context
random
origin
Returns
boolean
Whether any placement of the feature reported success.
pos()
pos(
x,y,z):BlockPos
Defined in: world/FeatureWorld.ts:11
Builds a position.
Parameters
x
number
y
number
z
number
Returns
posKey()
posKey(
position):string
Defined in: world/FeatureWorld.ts:24
The canonical text key for a position, which the test world uses to index its store.
Parameters
position
Returns
string
predicateTypeNameOf()
predicateTypeNameOf(
value,path):string
Defined in: registry.ts:25
Strips the minecraft: prefix, reading the key the predicate registries dispatch on.
Parameters
value
unknown
path
string
Returns
string
projectedRandomPatchySquare()
projectedRandomPatchySquare(
block,projectThrough,size,maxProjectionHeight):ConfiguredFeature
Defined in: features/simple.ts:781
Scatters blocks over a square, thinning toward the corners, dropping each one onto the surface below it.
26.3 added this and removed random_patch. The corner thinning is the whole difference: a position's chance of being used falls with the product of its two offsets, so the patch comes out round rather than square.
Parameters
block
projectThrough
size
maxProjectionHeight
number
Returns
randomBetween()
randomBetween(
random,min,max):number
Defined in: placement/WorldgenRandom.ts:232
Returns a float in [min, max), as Java's Mth.randomBetween does.
Parameters
random
min
number
max
number
Returns
number
randomBetweenInclusive()
randomBetweenInclusive(
random,min,max):number
Defined in: placement/WorldgenRandom.ts:224
Returns an integer in [min, max], as Java's Mth.randomBetweenInclusive does.
Parameters
random
min
number
max
number
Returns
number
randomBlockProvider()
randomBlockProvider(
names,tag?):BlockStateProvider
Defined in: providers/blockStateProvider.ts:193
Draws one block uniformly from a set and uses its default state.
The vanilla uses name a tag (#minecraft:corals), so this needs the oracle to enumerate it. When the oracle cannot, the provider yields nothing and the caller keeps the existing block, which is Java's behavior for an empty holder set.
Parameters
names
readonly string[]
tag?
string
Returns
randomBooleanSelector()
randomBooleanSelector(
whenTrue,whenFalse):ConfiguredFeature
Defined in: features/simple.ts:66
Runs one of two placed features on a coin flip.
Parameters
whenTrue
whenFalse
Returns
randomChance()
randomChance(
chance):PlacementModifier
Defined in: placement/modifiers.ts:112
Keeps the position with the given probability.
Parameters
chance
number
Returns
randomElement()
randomElement<
T>(items,random):T
Defined in: placement/WorldgenRandom.ts:248
Picks one element uniformly, as Java's Util.getRandom(List, RandomSource) does.
Type Parameters
T
T
Parameters
items
readonly T[]
random
Returns
T
randomNeighborSpread()
randomNeighborSpread(
block,acceptedNeighbors,canReplace,attempts,xzOffset,yOffset):ConfiguredFeature
Defined in: features/simple.ts:353
Places a block at the origin and scatters more wherever exactly one accepted neighbor sits.
Parameters
block
acceptedNeighbors
canReplace
attempts
xzOffset
yOffset
Returns
randomSelector()
randomSelector(
features,fallback):ConfiguredFeature
Defined in: features/simple.ts:90
Walks a list of chance-weighted features, taking the first whose roll succeeds.
Java marks this deprecated in favor of weighted_random_selector, but 21 vanilla features still use it, and the draw pattern differs: this rolls once per entry until one passes, so the number of draws depends on where the winner sits.
Parameters
features
readonly object[]
fallback
Returns
randomWeighted()
randomWeighted<
T>(entries,random):T
Defined in: placement/WorldgenRandom.ts:266
Draws one entry by weight, as Java's WeightedList.getRandomOrThrow does.
Java draws nextInt(totalWeight) and walks the list subtracting weights, so the draw count and the tie-breaking order both depend on the declared order of the entries.
Type Parameters
T
T
Parameters
entries
readonly Weighted<T>[]
random
Returns
T
randomizedIntProvider()
randomizedIntProvider(
source,property,values):BlockStateProvider
Defined in: providers/blockStateProvider.ts:137
Draws a source state, then randomizes one integer property on it.
Java looks the property up in the block's real state definition. This package has no block registry, so it sets the property when the source state declares it and leaves the state alone when it does not, which is the same answer for every provider in the vanilla data because each one spells the property out in its source state.
Parameters
source
property
string
values
Returns
randomlySelected()
randomlySelected(
placements):PlacementModifier
Defined in: placement/modifiers.ts:316
Runs one of several modifiers, drawn uniformly.
Parameters
placements
readonly PlacementModifier[]
Returns
rarityFilter()
rarityFilter(
chance):PlacementModifier
Defined in: placement/modifiers.ts:108
Keeps the position with probability 1 / chance. Costs one draw whether it passes or not.
Parameters
chance
number
Returns
readStateObject()
readStateObject(
source,path):Record<string,unknown>
Defined in: features/caves.ts:924
Shared with the structural features, which also read a block state object out of a field.
Parameters
source
unknown
path
string
Returns
Record<string, unknown>
relative()
relative(
position,direction,distance?):BlockPos
Defined in: features/support.ts:10
Returns the position one step in a direction.
Parameters
position
direction
distance?
number = 1
Returns
replaceSingleBlock()
replaceSingleBlock(
replacements):ConfiguredFeature
Defined in: features/simple.ts:150
Replaces the block at the origin with the first replacement whose rule test matches.
Parameters
replacements
readonly BlockReplacement[]
Returns
resolveAnchor()
resolveAnchor(
anchor,context):number
Defined in: providers/heightProvider.ts:37
Resolves an anchor to a y in the given dimension.
Parameters
anchor
context
Returns
number
rootSystem()
rootSystem(
config):ConfiguredFeature
Defined in: features/structural.ts:689
The azalea tree's rooted dirt column, Java's root_system.
Parameters
config
Returns
rotatedProvider()
rotatedProvider(
source,direction?):BlockStateProvider
Defined in: providers/blockStateProvider.ts:154
Draws a source state and turns it to face a direction, randomly when none is given.
trySetValue in Java sets a property only when the block has it. Here that is the same test against the state's declared properties.
Parameters
source
direction?
Returns
ruleBasedProvider()
ruleBasedProvider(
rules,fallback?):BlockStateProvider
Defined in: providers/blockStateProvider.ts:173
Takes the first rule whose predicate holds, falling back when none does.
Parameters
rules
readonly object[]
fallback?
Returns
safeSetBlock()
safeSetBlock(
world,position,state,canReplace):boolean
Defined in: features/support.ts:26
Writes a state only when a test on the block already there passes, Java's safeSetBlock.
Parameters
world
position
state
canReplace
(existing) => boolean
Returns
boolean
sameState()
sameState(
a,b):boolean
Defined in: world/BlockState.ts:91
Answers whether two states are identical, properties included.
Parameters
a
b
Returns
boolean
scanColumn()
scanColumn(
world,origin,searchRange,inside,validEdge):ScannedColumn|undefined
Defined in: features/caves.ts:61
Java's Column.scan.
It walks up to searchRange - 1 steps in each direction while inside holds, and reports the stopping position only when validEdge holds there. Both ends are the edge block, not the last inside block, which is why a caller adds or subtracts one before placing.
Parameters
world
origin
searchRange
number
inside
(state, world) => boolean
validEdge
(state, world) => boolean
Returns
ScannedColumn | undefined
scatteredOre()
scatteredOre(
targets,size,discardChanceOnAirExposure):ConfiguredFeature
Defined in: features/ore.ts:181
The loose ore, Java's ScatteredOreFeature.
It makes up to size independent attempts, each at a position drawn from a difference of two floats so the spread is triangular rather than uniform, and each capped at seven blocks from the origin. Copper in the dripstone caves is the only vanilla user.
Parameters
targets
readonly BlockReplacement[]
size
number
discardChanceOnAirExposure
number
Returns
sculkPatch()
sculkPatch(
chargeCount,amountPerCharge,spreadAttempts,growthRounds,spreadRounds):ConfiguredFeature
Defined in: features/caves.ts:661
The sculk patch, Java's sculk_patch.
Java runs its SculkSpreader here, which is the same charge-and-cursor simulation the sculk catalyst uses at runtime and lives in the block layer rather than in world generation. This places the seed block and reports success, and the README records the spreader as the caller's job: a server that has sculk behavior already owns the algorithm.
Parameters
chargeCount
number
amountPerCharge
number
spreadAttempts
number
growthRounds
number
spreadRounds
number
Returns
sequence()
sequence(
features):ConfiguredFeature
Defined in: features/simple.ts:120
Runs every placed feature in order and stops at the first failure.
Parameters
features
readonly PlacedFeature[]
Returns
shuffledCopy()
shuffledCopy<
T>(items,random):T[]
Defined in: features/support.ts:40
Shuffles a copy of a list the way Java's Util.shuffle does.
The direction order several features draw out of this decides which face a growth attaches to, so the swap order matters as much as the result: Java walks from the end and swaps with a draw in [0, i).
Type Parameters
T
T
Parameters
items
readonly T[]
random
Returns
T[]
simpleBlock()
simpleBlock(
toPlace,scheduleTick):ConfiguredFeature
Defined in: features/simple.ts:139
Places one block, if it would survive there.
Java has two special cases this cannot reproduce without a block registry: a double plant places both halves, and a mossy carpet spreads onto its neighbors. Both are recorded in the README as the places where a server's own block behavior has to finish the job.
Parameters
toPlace
scheduleTick
boolean
Returns
simpleProvider()
simpleProvider(
state):BlockStateProvider
Defined in: providers/blockStateProvider.ts:58
Always the same state.
Parameters
state
Returns
simpleRandomSelector()
simpleRandomSelector(
features):ConfiguredFeature
Defined in: features/simple.ts:55
Runs one of several placed features, drawn uniformly. Costs one draw.
Parameters
features
readonly PlacedFeature[]
Returns
singleBlockPillar()
singleBlockPillar(
block,canReplace,direction,chanceToContinue,capFeature?):ConfiguredFeature
Defined in: features/simple.ts:271
Stacks one block upward or downward while a predicate and a per-block chance both hold.
Parameters
block
canReplace
direction
chanceToContinue
number
capFeature?
Returns
sortFeaturesPerStep()
sortFeaturesPerStep(
biomeFeatures): readonly (readonlystring[])[]
Defined in: placement/featureSorter.ts:36
Merges every biome's per-step feature order into one order per step.
Parameters
biomeFeatures
Iterable<readonly (readonly string[])[]>
One entry per biome, each a list indexed by decoration step of the placed feature identifiers that biome runs in that step, in the biome's own order.
Returns
readonly (readonly string[])[]
One list per step, deduplicated and ordered. A feature's position in its step's list is the index that seeds it, so two biomes that share a feature seed it identically. The result has as many steps as the longest input, which may be fewer than the eleven Java defines.
Throws
Error when two biomes order the same pair of features opposite ways, which leaves no order that satisfies both. Java fails the same way, with Feature order cycle found.
speleothem()
speleothem(
baseBlock,pointedBlock,replaceableBlocks,chanceOfTallerGeneration,chanceOfDirectionalSpread,chanceOfSpreadRadius2,chanceOfSpreadRadius3):ConfiguredFeature
Defined in: features/caves.ts:161
One pointed dripstone with a small patch of base block under it, Java's speleothem.
26.3 renamed this from pointed_dripstone and made the two blocks configurable, which is what lets the nether's sulfur spikes reuse it.
Parameters
baseBlock
string
pointedBlock
string
replaceableBlocks
chanceOfTallerGeneration
number
chanceOfDirectionalSpread
number
chanceOfSpreadRadius2
number
chanceOfSpreadRadius3
number
Returns
speleothemCluster()
speleothemCluster(
config):ConfiguredFeature
Defined in: features/caves.ts:228
A field of stalactites and stalagmites, Java's speleothem_cluster.
Parameters
config
Returns
spike()
spike(
state,canPlaceOn,canReplace):ConfiguredFeature
Defined in: features/structural.ts:814
The basalt pillar and its nether cousins, Java's spike.
Parameters
state
canPlaceOn
canReplace
Returns
springFeature()
springFeature(
fluid,requiresBlockBelow,rockCount,holeCount,validBlocks):ConfiguredFeature
Defined in: features/simple.ts:584
Opens a one-block fluid spring in a wall with exactly the declared rock and hole counts.
Parameters
fluid
requiresBlockBelow
boolean
rockCount
number
holeCount
number
validBlocks
Returns
steppedColumnCluster()
steppedColumnCluster(
config):ConfiguredFeature
Defined in: features/caves.ts:697
The nether's stepped columns, Java's stepped_column_cluster.
Parameters
config
Returns
surfaceRelativeThresholdFilter()
surfaceRelativeThresholdFilter(
heightmap,minInclusive,maxInclusive):PlacementModifier
Defined in: placement/modifiers.ts:165
Keeps the position when its y sits within a window around a heightmap's surface.
Parameters
heightmap
minInclusive
number
maxInclusive
number
Returns
surfaceWaterDepthFilter()
surfaceWaterDepthFilter(
maxWaterDepth):PlacementModifier
Defined in: placement/modifiers.ts:176
Keeps the position when no more than maxWaterDepth of water covers the ocean floor.
Parameters
maxWaterDepth
number
Returns
templateFeature()
templateFeature(
templates,processors?):ConfiguredFeature
Defined in: features/structural.ts:606
Places one template from a weighted list, Java's template.
Parameters
templates
readonly object[]
processors?
Returns
translatingWorld()
translatingWorld<
Target>(target,mapper,blocks):FeatureWorld
Defined in: world/FeatureWorld.ts:248
Wraps a world that stores non-Java states so features can write Java states into it.
This is the injection point the plan's section 5 asks for: the mapping table is applied once, at the seam, rather than inside every feature.
Type Parameters
Target
Target
Parameters
target
TargetWorld<Target>
mapper
BlockStateMapper<Target>
blocks
Returns
trapezoidFloat()
trapezoidFloat(
min,max,plateau):FloatProvider
Defined in: providers/valueProviders.ts:238
A trapezoidal float distribution. Costs two draws.
Parameters
min
number
max
number
plateau
number
Returns
trapezoidHeight()
trapezoidHeight(
min,max,plateau):HeightProvider
Defined in: providers/heightProvider.ts:131
A trapezoidal y distribution with a flat top plateau wide. Costs one or two draws.
Parameters
min
max
plateau
number
Returns
trapezoidInt()
trapezoidInt(
min,max,plateau):IntProvider
Defined in: providers/valueProviders.ts:88
A trapezoidal distribution over [min, max] with a flat top plateau wide.
The symmetric triangle case, which the offset modifier uses everywhere, takes a shortcut of two draws from the same bound rather than the general two-draw form.
Parameters
min
number
max
number
plateau
number
Returns
tree()
tree(
config):ConfiguredFeature
Defined in: features/tree.ts:46
Builds a tree, Java's TreeFeature.
Forty-five of the 240 vanilla configured features are this one type. All of the variety lives in the four composable parts: a trunk placer that returns where foliage should attach, a foliage placer that fills those attachments, an optional root placer, and a list of decorators.
The order of the draws is the part worth stating. tree_height comes first, then foliage_height, then foliage_radius, then the root placer's trunk offset, then the whole trunk, then each attachment's foliage in the order the trunk placer returned them, then the decorators in their declared order. Moving any of those moves every block after it.
Parameters
config
Returns
typeNameOf()
typeNameOf(
value,path):string
Defined in: registry.ts:19
Strips the minecraft: prefix from a dispatch key so a switch can match the short form.
Parameters
value
unknown
path
string
Returns
string
underwaterMagma()
underwaterMagma(
floorSearchRange,placementRadiusAroundFloor,placementProbabilityPerValidPosition):ConfiguredFeature
Defined in: features/simple.ts:300
Scatters magma blocks on an underwater floor, avoiding any that would be visible from the side.
Parameters
floorSearchRange
number
placementRadiusAroundFloor
number
placementProbabilityPerValidPosition
number
Returns
uniformFloat()
uniformFloat(
min,max):FloatProvider
Defined in: providers/valueProviders.ts:230
A uniform float in [min, max). Costs one draw.
Parameters
min
number
max
number
Returns
uniformHeight()
uniformHeight(
min,max):HeightProvider
Defined in: providers/heightProvider.ts:96
A uniform y in [min, max]. Costs one draw.
Java collapses an inverted range to min with a warning rather than failing, because the range depends on the dimension and a datapack cannot always know it is valid. Reproduced here.
Parameters
min
max
Returns
uniformInt()
uniformInt(
min,max):IntProvider
Defined in: providers/valueProviders.ts:49
A uniform integer in [min, max]. Costs one draw.
Parameters
min
number
max
number
Returns
validTreePos()
validTreePos(
world,position):boolean
Defined in: features/tree/shared.ts:169
Answers Java's TreeFeature.validTreePos: air, or a block trees are allowed to grow through.
Parameters
world
position
Returns
boolean
vegetationPatch()
vegetationPatch(
config,waterlogged?):ConfiguredFeature
Defined in: features/caves.ts:562
A patch of ground with vegetation on it, Java's vegetation_patch.
surface decides which way is in: a floor patch carves down into the ground and grows up, and a ceiling patch does the reverse, which is how one implementation covers both the lush cave moss floor and its ceiling.
Parameters
config
waterlogged?
boolean = false
Returns
veryBiasedToBottomHeight()
veryBiasedToBottomHeight(
min,max,inner):HeightProvider
Defined in: providers/heightProvider.ts:118
A y weighted hard toward the bottom. Costs three draws.
Parameters
min
max
inner
number
Returns
veryBiasedToBottomInt()
veryBiasedToBottomInt(
min,max):IntProvider
Defined in: providers/valueProviders.ts:71
A value in [min, max] weighted hard toward min. Costs three draws.
Parameters
min
number
max
number
Returns
vines()
vines():
ConfiguredFeature
Defined in: features/simple.ts:632
Hangs a vine on the first face of the origin that has a block behind it.
Returns
voidStartPlatform()
voidStartPlatform():
ConfiguredFeature
Defined in: features/simple.ts:232
Builds the stone platform a player spawns on in a void world.
Returns
walkFeatures()
walkFeatures(
root):Generator<ConfiguredFeature>
Defined in: features/Feature.ts:102
Walks a feature and everything it delegates to, depth first, including the root.
Parameters
root
Returns
Generator<ConfiguredFeature>
weightedListHeight()
weightedListHeight(
entries):HeightProvider
Defined in: providers/heightProvider.ts:146
Picks a nested provider by weight, then draws from it.
Parameters
entries
readonly Weighted<HeightProvider>[]
Returns
weightedListInt()
weightedListInt(
entries):IntProvider
Defined in: providers/valueProviders.ts:127
Picks a nested provider by weight, then draws from it. Costs one draw plus the nested cost.
Parameters
entries
readonly Weighted<IntProvider>[]
Returns
weightedProvider()
weightedProvider(
entries):BlockStateProvider
Defined in: providers/blockStateProvider.ts:61
Draws one of several states by weight. Costs one draw.
Parameters
entries
readonly Weighted<BlockState>[]
Returns
weightedRandomSelector()
weightedRandomSelector(
features):ConfiguredFeature
Defined in: features/simple.ts:74
Runs one placed feature drawn by weight.
Parameters
features
readonly object[]
Returns
withProperties()
withProperties(
state,values):BlockState
Defined in: world/BlockState.ts:72
Returns a copy of state with several properties set at once.
Parameters
state
values
Readonly<Record<string, string>>
Returns
withProperty()
withProperty(
state,key,value):BlockState
Defined in: world/BlockState.ts:68
Returns a copy of state with one property set, leaving the original untouched.
Parameters
state
key
string
value
string
Returns
withinManhattan()
withinManhattan(
center,rangeX,rangeY,rangeZ):Generator<BlockPos>
Defined in: features/support.ts:79
Iterates a box in Java's BlockPos.withinBoxByManhattanDistance order.
It spirals outward by Manhattan distance, which is why delta_feature and netherrack_replace_blobs can stop at the first position past their radius instead of filtering the whole box.
Parameters
center
rangeX
number
rangeY
number
rangeZ
number
Returns
Generator<BlockPos>