Skip to content

Placed Features

A PlacedFeature is a configured feature together with a list of placement modifiers that decide where, how often, and under what conditions it should generate.

A placed feature is either a reference to one already registered or a custom authored one.

The PlacedFeatures catalog holds typed references to every placeable vanilla feature.

ExamplePlugin.java Java
import me.outspending.biomesapi.wrapper.worldgen.placement.PlacedFeature;
import me.outspending.biomesapi.wrapper.worldgen.placement.PlacedFeatures;

PlacedFeature diamonds = PlacedFeatures.ORE_DIAMOND;

To author one, pass a configured feature and the placement modifiers that position it.

ExamplePlugin.java Java
import me.outspending.biomesapi.wrapper.worldgen.HeightmapType;
import me.outspending.biomesapi.wrapper.worldgen.PlacementModifier;
import me.outspending.biomesapi.wrapper.worldgen.feature.ConfiguredFeatures;
import me.outspending.biomesapi.wrapper.worldgen.placement.PlacedFeature;

PlacedFeature flowers = PlacedFeature.of(
  ConfiguredFeatures.FLOWER_DEFAULT,
  PlacementModifier.rarityFilter(8),
  PlacementModifier.inSquare(),
  PlacementModifier.heightmap(HeightmapType.MOTION_BLOCKING),
  PlacementModifier.biomeFilter()
);

Placement modifiers run in order, each transforming the set of positions the feature will generate at.

Such as:

  • count(n) / count(IntProvider): generate the feature a fixed or variable number of times per chunk.
  • rarityFilter(n): generate on average once every n chunks.
  • inSquare(): spread the position randomly within the chunk.
  • heightmap(HeightmapType): place at the surface height of the given heightmap.
  • heightRangeUniform(...) / heightRangeTriangle(...): choose a Y within a vertical range.
  • biomeFilter(): only generate if the target biome matches. Almost always added last.