Custom feature

Features are small decorations that can at most write to a 3×3 chunk area centered on the placement chunk. They're locally placed per-chunk and cannot be searched for using commands. Examples are trees, flowers, ore, etc.
== Feature Type ==
A feature type (sometimes called feature) determines how and what to generate.
=== List of feature types ===
The IDs of all feature types are listed below:
* —Does nothing. Useful for overwriting existing configured features.
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* —Only if there is water at the current block, places blocks in a circular formation using the specified radius and deepness.
* 
* 
* 
* 
* —Fills all air blocks in a 16×1×16 layer of blocks. Used by the game in flat worlds.
* 
* 
* —Can place a small structure.
* —Places snow and replaces water with ice in snowy biomes.
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* —Replaces all target blocks in a certain radius with another block. If it doesn't find the target block at its position, it will move down before generating until it finds one.
* 
* 
* 
* —Randomly chooses one of two features with each having an equal chance.
* —Randomly chooses a feature from a list with chances.
* 
* —Replaces a single block using a list of targets and states.
* —Generates a root column with a feature on top.
* 
* 
* 
* 
* 
* —Randomly chooses a feature from a list with each having an equal chance.
* 
* 
* 
* 
* 
* 
* 
* —A vegetation patch but it will try to waterlog the blocks placed.
* 
== Configured Feature ==
A feature type determines how to generate a feature, but the specific details need to be configured additionally. After configured, it is called a configured feature, or simply called a feature.
Configured features are stored as JSON files within a data pack in the path data/<namespace>/worldgen/configured_feature.
=== JSON Format ===
== Placed feature ==
A configured feature determines what to be generated, but additional definition is required to determine where and how to place it in world generation. After added placement modifiers, it is called a placed feature.
Placed features are stored as JSON files within a data pack in the path data/<namespace>/worldgen/placed_feature.
=== JSON Format ===
* : Root object.
** : A configured feature's ID, or a object of a configured feature.
** : A list of placement modifiers. They are applied in order.
*** : A placement modifier.
**** : The type of this placement modifier.
**** Other additional fields depend on the value of , described below.
=== Placement Modifier ===
A placement modifier takes in a initial position and returns empty or one or more block positions. Each position represents a generation attempt here. The placement modifier can return empty to cancel the attempt; return multiple copies of the same position to increase the number of attempts here; return some different positions to make multiple attempts in different positions.
For a placed feature, the placement modifiers in the list are applied in order to get the final list of positions from the initial position, then the feature will attempt to generate at those positions. When generating a feature directly, the initial position is the bottom northwest corner of a chunk. When referenced by another feature (such as being referenced by a feature of type random_selector, or by a structure pool), the initial position is where the feature is to be generated.
The possible values for and associated additional fields:
* biome—Either returns the current position or empty. Only passes if the biome at the current position includes this placed feature. No additional field. Important: This modifier type cannot be used in placed features that are referenced from other configured features.
* block_predicate_filter—Returns the current position when the predicate is passed, otherwise return empty.
** : The block predicate to test.
*** 
* carving_mask—Returns all positions in the current chunk that have been carved out by a carver. This does not include blocks carved out by noise caves.
** : The carving step. Either air or liquid.
* count—Returns multiple copies of the current block position.
** : Value between 0 and 256 (inclusive).
*** 
* count_on_every_layer—In the horizontal relative range (0,0) to (16,16), at each vertical layer separated by air, lava or water, tries to randomly select the specified number of horizonal positions, whose Y coordinate is one block above this layer at this selected horizonal position. Return these selected positions.
** ：Count on each layer. Value between 0 and 256 (inclusive).
*** 
* environment_scan—Scans blocks either up or down, until the target condition is met. Returns the block position for which the target condition matches. If no target can be found within the maximum number of steps, returns empty.
** : One of up or down.
** : Value between 1 and 32 (inclusive).
** : The block predicate that is searched for.
*** 
** : (optional) If specified, each step must match this block position in order to continue the scan. If a block that doesn't match it is met, but no target block found, returns empty.
*** 
* height_range—Sets the Y coordinate to a value provided by a height provider. Returns the new position.
** : The new Y coordinate.
*** 
* heightmap—Sets the Y coordinate to one block above the heightmap. Returns the new position.
** : The heightmap to use. One of MOTION_BLOCKING, MOTION_BLOCKING_NO_LEAVES, OCEAN_FLOOR, OCEAN_FLOOR_WG, WORLD_SURFACE or WORLD_SURFACE_WG.
* in_square—For both X and Z, it adds a random value between 0 and 15 (both inclusive). This is a shortcut for a random_offset modifier with y_spread set to 0 and xz_spread as a uniform int from 0 to 15. No additional fields.
* noise_based_count—When the noise value at the current block position is positive, returns multiple copies of the current block position, whose count is based on a noise value and can gradually change based on the noise value. When noise value is nagetive or 0, returns empty. The count is calculated by ceil((noise(x / noise_factor, z / noise_factor) + noise_offset) * noise_to_count_ratio).
** : Scales the noise input horizontally. Higher values make for wider and more spaced out peaks.
** ：(optional, defaults to 0) Vertical offset of the noise.
** : Ratio of noise value to count.
* noise_threshold_count—Returns multiple copies of the current block position. The count is either below_noise or above_noise, based on the noise value at the current block position. First checks noise(x / 200, z / 200) < noise_level. If that is true, uses below_noise, otherwise above_noise.
** : The threshold within the noise of when to use below_noise or above_noise.
** : The count when the noise is below the threshold. Value lower than 0 is treated as 0.
** : The count when the noise is above the threshold. Value lower than 0 is treated as 0.
* random_offset—Applies an offset to the current position. Note that the even though X and Z share the same int provider, they are individually sampled, so a different offset can be applied to X and Z.
** : Value between -16 and 16 (inclusive).
*** 
** : Value between -16 and 16 (inclusive).
*** 
* rarity_filter—Either returns the current position or empty. The chance is calculated by 1 / chance.
** : Must be a positive integer.
* surface_relative_threshold_filter—Returns the current position if the surface is inside a range. Otherwise returns empty.
** ：The heightmap to use. One of MOTION_BLOCKING, MOTION_BLOCKING_NO_LEAVES, OCEAN_FLOOR, OCEAN_FLOOR_WG, WORLD_SURFACE or WORLD_SURFACE_WG.
** : The minimum relative height from the surface to current position.
** : The maxinum relative height from the surface to current position.
* surface_water_depth_filter—If the number of blocks of a motion blocking material under the surface (the top non-air block) is less than the specified depth, return the current position. Otherwise return empty.
** : The maximum allowed depth.
==History ==
ja:生成物のカスタマイズ
zh:自定义地物