Skip to content

Forest rock feature

The forest_rock feature can be used to generate small \(3x3\) rocks in the world.

Configuration

Only the block state used for the rocks is configurable:

Option Type Description
state A BlockState The block state to use for the rock.

In code, the BlockStateConfiguration class is used to configure the feature.

Example

ConfiguredFeatures.kt
val FOREST_ROCK = FeatureRegistry.registerConfiguredFeature(
    Machines,
    "forest_rock",
    Feature.FOREST_ROCK,
    BlockStateConfiguration(Blocks.MOSSY_COBBLESTONE.defaultBlockState())
)
PlacedFeatures.kt
val FOREST_ROCK = FeatureRegistry.registerPlacedFeature(
    Machines,
    "forest_rock",
    ConfiguredFeatures.FOREST_ROCK,
    listOf(
        CountPlacement.of(2), // (1)!
        InSquarePlacement.spread(), // (2)!
        PlacementUtils.HEIGHTMAP, // (3)!
        BiomeFilter.biome() // (4)!
    )
)
  1. Generate 2 rocks per chunk.
  2. Randomly offset the x- and z-coordinates of the rock.
  3. Set the y-coordinate of the rock to the highest motion-blocking block. The static constant is equivalent to
    HeightmapPlacement.onHeightmap(Heightmap.Types.MOTION_BLOCKING)
    
  4. Only generate the feature if the center pos hasn't moved to another biome that doesn't have the forest_rock feature.
configured_feature/forest_rock.json
{
  "type": "minecraft:forest_rock",
  "config": {
    "state": {
      "Name": "minecraft:mossy_cobblestone"
    }
  }
}
placed_feature/forest_rock.json
{
  "feature": "minecraft:forest_rock",
  "placement": [
    {
      "type": "minecraft:count",
      "count": 2 // (1)!
    },
    {
      "type": "minecraft:in_square" // (2)!
    },
    {
      "type": "minecraft:heightmap",
      "heightmap": "MOTION_BLOCKING" // (3)!
    },
    {
      "type": "minecraft:biome" // (4)!
    }
  ]
}
  1. Generate 2 rocks per chunk.
  2. Randomly offset the x- and z-coordinates of the rock.
  3. Set the y-coordinate of the rock to the highest motion-blocking block.
  4. Only generate the feature if center pos hasn't moved to another biome that doesn't have the forest_rock feature.

Result

Example

Example