Skip to content

Structures in Custom Biomes

A structure generates wherever the biome is in its biome list.

Vanilla structures list their biomes through tags. The plains village, for example, uses #minecraft:has_structure/village_plains. Adding your biome to that tag with append() is enough to get the job done:

ExamplePlugin.java Java
import dev.wyck.biome.Biome;
import dev.wyck.keys.ResourceKey;
import dev.wyck.tags.TagSet;

@Override
public void onLoad() {
  TagSet.ofBiomes(
      ResourceKey.of("minecraft", "has_structure/village_desert"),
      Biome.reference(ResourceKey.of("wyck", "ancient_meadow"))
  ).append();
}

You can copy a structure with your biomes inserted instead when you want your own placement, for a structure that generates only in your biome:

ExamplePlugin.java Java
import dev.wyck.biome.Biome;
import dev.wyck.keys.ResourceKey;
import dev.wyck.tags.TagSet;
import dev.wyck.worldgen.structure.StructureSet;
import dev.wyck.worldgen.structure.Structures;
import dev.wyck.worldgen.structure.placement.RandomSpreadPlacement;
import dev.wyck.worldgen.structure.types.DefinedStructure;

@Override
public void onLoad() {
  DefinedStructure village = ((DefinedStructure) Structures.VILLAGE_DESERT.wrap())
      .withSettings(settings -> settings.toBuilder()
          .biomes(TagSet.ofBiomes(Biome.reference(ResourceKey.of("wyck", "ancient_meadow"))))
          .build())
      .withResourceKey(ResourceKey.of("wyck", "meadow_village"));
  village.register();

  StructureSet.of(village, RandomSpreadPlacement.of(24, 6, 739104582))
      .toBuilder()
      .resourceKey(ResourceKey.of("wyck", "meadow_villages"))
      .build()
      .register();
}