Skip to content

Carvers

Carvers are responsible for ‘carving’ out areas of a world to create caves, canyons, ravines, and other underground features.

A WorldCarver is either a reference to a carver already in the game, or a custom carver you may author from a carver type and a configuration. Both are added to a biome through its generation settings.

The Carvers catalog holds typed references to every vanilla carver.

ExamplePlugin.java Java
import dev.wyck.biome.BiomeGenerationSettings;
import dev.wyck.worldgen.carver.Carvers;

BiomeGenerationSettings generation = BiomeGenerationSettings.builder()
  .carver(Carvers.CAVE)
  .carver(Carvers.CANYON)
  .build();

To author your own, pair a carver type with a configuration.

Java
import dev.wyck.worldgen.carver.CaveWorldCarver;
import dev.wyck.worldgen.carver.WorldCarver;
import dev.wyck.worldgen.valueproviders.FloatProvider;
import dev.wyck.worldgen.heightproviders.HeightProvider;
import dev.wyck.worldgen.heightproviders.VerticalAnchor;

WorldCarver cave = WorldCarver.cave().config(
  CaveWorldCarver.builder()
      .probability(0.15f)
      .y(HeightProvider.uniform(VerticalAnchor.aboveBottom(8), VerticalAnchor.absolute(180)))
      .horizontalRadiusMultiplier(FloatProvider.uniform(0.7f, 1.4f))
      .verticalRadiusMultiplier(FloatProvider.uniform(0.8f, 1.3f))
      .floorLevel(FloatProvider.uniform(-1.0f, -0.4f))
      .build()
).build();