Skip to content

Block pile feature

The block_pile can be used to place piles of blocks (for example hay/melons in villages) in the world.

Configuration

A block pile feature only has the state_provider option:

Option Type Description
state_provider A BlockStateProvider The block state to use for the pile.

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

Example

As an example, here's the placed and configured feature used to place piles of hay bales in villages.

ConfiguredFeatures.kt
val PILE_HAY = FeatureRegistry.registerConfiguredFeature(
    Machines,
    "pile_hay",
    Feature.BLOCK_PILE,
    BlockPileConfiguration(RotatedBlockProvider(Blocks.HAY_BLOCK)) // (1)!
)
  1. Randomly rotate the hay bales.
PlacedFeatures.kt
val PILE_HAY = FeatureRegistry.registerPlacedFeature(
    Machines,
    "pile_hay",
    ConfiguredFeatures.PILE_HAY,
    emptyList() // (1)!
)
  1. The feature does all the location resolving itself.
configured_feature/pile_hay.json
{
  "type": "minecraft:block_pile",
  "config": {
    "state_provider": {
      "type": "minecraft:rotated_block_provider",
      "state": {
        "Name": "minecraft:hay_block",
        "Properties": {
          "axis": "y" // (1)!
        }
      }
    }
  }
}
  1. Randomly rotate the hay bales.
placed_feature/pile_hay.json
{
  "feature": "minecraft:pile_hay",
  "placement": [] // (1)!
}
  1. The feature does all the location resolving itself.

Result

Example

Example