Files
misode.github.io/guides/placed-features.md
2022-06-26 03:25:48 +00:00

8.3 KiB

title, versions, tags
title versions tags
Placed features and their configuration
1.18
1.18.2
1.19
worldgen
features

Placed features are a combination of a configured feature and a list of placement modifiers. They decide the placement of a feature in biomes. This includes position, rarity, count, filters, and more.

Placed features

Placed features are referenced in the ffeatures list of biomes. They may also be referenced in some configured features types, such as in the vegetation_patch feature.

Let's look at an example placed feature:

{
  "feature": "minecraft:monster_room",
  "placement": [
    {
      "type": "minecraft:count",
      "count": 2
    }
  ]
}

There are two fields in the placed feature configuration:

  • ffeature: The configured feature that the placed feature is going to place. Can either be referencing a configured feature file or be directly inlined.
  • fplacement: The list of placement modifiers, in order. Each modifier has a ftype field and depending on the placement modifier, extra fields for configuration.

Placement modifiers

Without any placement modifiers a feature is by default placed once at the most negative corner of the chunk at Y=0. Using a combination of different modifiers, this position can be altered.

In general there are 3 categories of modifiers, although some modifiers fall in multiple categories:

Modifier types

biome

Returns the current position if the biome at the current position includes this placed feature. Otherwise, returns nothing.

Note: can only be used in placed features that are directly referenced in a biome!

This placement modifier has no extra fields.

block_predicate_filter

Checks for block(s) relative to the current position. If the predicate passes, the current position is returned. Otherwise, returns nothing.

  • fpredicate: The predicate to check
    • ftype: The predicate type
      • sall_of: Contains a list of predicates. All listed predicates must pass for the predicate to pass.
      • sany_of: Contains list of predicates. At least one predicate must pass for the predicate to pass.
      • shas_sturdy_face: Contains an offset and a direction. Checks if the block in the specified direction provides full support on that face.
      • sinside_world_bounds: Contains an offset, with no extra fields.
      • smatching_block_tag: Contains a block tag along with a block offset. If the block at the offset matches any block in the block tag, the predicate passes.
      • smatching_blocks: Contains a list of blocks along with a block offset. If the block at the offset matches any block in the list, the predicate passes.
      • smatching_fluids: Identical to matching_blocks, but takes a list of fluids instead.
      • snot: Contains another predicate inside of it. If the predicate inside it fails, the not predicate passes.
      • sreplaceable: Contains no extra fields
      • ssolid: Contains no extra fields
      • strue: Always passes.
      • swould_survive: Contains an offset and a block state. If the block at the offset would survive, the predicate passes.

carving_mask

Returns all locations in the current chunk if they have been carved out by any configured carver. Importantly, this does not include noise caves.

  • fstep: Either air or liquid

count

Returns copies of the current position.

  • fcount: The number of placements at the current block position

count_on_every_layer

Returns block positions on every vertical layer, randomly spread within the chunk.

  • fcount: The number of placements on each vertical layer

environment_scan

Searches either up or down for a target block condition within the step limit. If a suitable block is found, that position is returned. Otherwise, returns nothing.

  • fdirection_of_search: Direction that the placement modifier searches, either up or down
  • fmax_steps: The max number of blocks that the placement modifier searches, must be an integer between 1 and 32
  • ftarget_condition: The block predicate a searched block must meet for that block position to be returned
  • fallowed_search_condition: (optional) A block predicate blocks at each step must meet for the scan to continue

height_range

Modifies the vertical coordinate to be within the height range.

  • fheight: The height provider the placements must be contained in

heightmap

Modifiers the vertical coordinate to match the provided heightmap.

in_square

Randomizes the placement horizontally in the chunk. It does this by adding a random value to both the X and Z coordinates between 0 and 15 (inclusive).

This placement modifier has no extra fields.

noise_based_count

Returns copies of the current block position, based on a noise value at the current location.

Uses a global 2D simplex noise with one octave.

  • fnoise_to_count_ratio: Determines how strongly the noise affects the resulting count
  • fnoise_factor: Stretches the noise on the x-axis and z-axis, higher values lead to more spaced out noise peaks
  • fnoise_offset: (optional) Offsets the threshold where features are generated, defaults to 0

noise_threshold_count

Returns copies of the current block position. The number of copies depends on whether or not the noise at the given position is above the noise_level.

Uses a global 2D simplex noise with one octave.

  • fnoise_level: The threshold value, useful range is -1 to 1
  • fbelow_noise: The count if the noise value is below the fnoise_level
  • fabove_noise: The count if the noise value is above the fnoise_level

random_offset

Offsets the current block position on each axis. (While the x-axis and z-axis share a integer provider, they can be assigned different offsets.)

  • fxz_spread: The offset on the x-axis and z-axis, any integer between -16 and 16
  • fy_spread: The offset on the y-axis, any integer between -16 and 16

rarity_filter

Either returns the current block position or nothing. The chance for the filter to pass is 1 / chance.

  • fchance: An integer, must be at least 1

surface_relative_threshold_filter

Checks if the heightmap is within a range, and returns the current position if so. If the check fails, nothing is returned,

  • fheightmap: The heightmap type to use provider
  • fmin_inclusive: The minimum vertical coordinate that the heightmap must be in
  • fmax_inclusive: The maximum vertical coordinate that the heightmap must be in

surface_water_depth_filter

Returns the current position if the block's depth in water is not above the provided max water depth. Otherwise returns nothing.

  • fmax_water_depth: The maximum depth in water the feature can be placed in.