Skip to main content

Creating Generators

Generators

Generators are the most powerful part of the configuration system for BetterStructures. By default there are 29 generators which collectively manage the builds currently distributed by BetterStructures, and while you can create your own generators, you can also use existing ones as a shortcut.

Generators tell the plugin where exactly things should spawn and define loot tables. The default generators are also named in ways that should be very easy to guess what they do.

Generator Configuration Options

KeyDefaultMandatoryDescription
isEnabledtrueWhether the generator is enabled. Setting it to false also stops every schematic pointing at this generator from being registered, so it is the quickest way to switch a whole set of structures off.
structureType-Where structures spawn (see table below)
lowestYLevel-59Minimum Y level for spawning
highestYLevel320Maximum Y level for spawning
validWorldsAll allowedList of worlds where structures can spawn
validWorldEnvironmentsAll allowedNORMAL, NETHER, THE_END, CUSTOM
validBiomesV2All biomesList of valid biomes (namespace:key format)
treasureFilename-Treasure file for chest loot
generateLootInBarrelstrueWhether barrels found in this generator's schematics should be filled with loot
barrelTreasureFilenametreasure_barrel_food.ymlTreasure file used to fill barrels for this generator

structureType

Sets what kind of structure the build is. You can specify multiple structure types for a single generator!

TypeOverworld / CustomNetherEndDescription
SURFACESurfaceSurface-like pointsSurfaceSpawns at the surface of the world
SKY80-120 blocks above the highest blockAir pocket found between Y 45 and Y 10080-120 blocks above the highest blockSpawns in the sky (configurable in config.yml)
UNDERGROUND_SHALLOWY 0-50Y 60-120Y 0-80Shallow underground structures
UNDERGROUND_DEEPY -53 to 0Y 5-60Y 0-80Deep underground structures
LIQUID_SURFACEWater (oceans)Lava ocean at Y 31No liquid check is appliedSpawns on liquid surfaces
DUNGEONUsed for modular dungeon placement

The sky ranges are offsets applied above the world's highest block at that column, not absolute Y levels.

Multiple Structure Types Example
structureType:
- SURFACE
- UNDERGROUND_SHALLOW

This allows the same generator to spawn structures in multiple locations, such as both on the surface and in shallow underground areas.

Note: There are two underground settings because Minecraft has a lot of underground space. Having both ensures even distribution across depths and prevents players from missing structures.


Y-Level Ranges by Dimension

Default altitude ranges per dimension (configurable in config.yml):

DimensionDefault RangeConfig Settings
Overworld/CustomY=-60 to Y=320lowestYNormalCustom / highestYNormalCustom
NetherY=4 to Y=120lowestYNether / highestYNether
EndY=0 to Y=320lowestYEnd / highestYEnd
Sky (Overworld/Custom)80 to 120 blocks above the highest blocknormalCustomAirBuildingMinAltitude / normalCustomAirBuildingMaxAltitude
Sky (End)80 to 120 blocks above the highest blockendAirBuildMinAltitude / endAirBuildMaxAltitude

These defaults can be overridden per-generator using lowestYLevel and highestYLevel.

The two sky rows are offsets added on top of the highest block in the column, not absolute Y levels. Both the Overworld/Custom and End sky offsets are rolled at random between their min and max on every placement.

The Nether ignores those offsets entirely: instead of building above the highest block, BetterStructures scans the column between Y 45 and Y 100 for an air pocket at least 20 blocks tall and places the structure inside it. If no such pocket exists, nothing spawns in that chunk.


Custom Biome Support

BetterStructures automatically supports custom biomes from world generators like Terralith, Iris, Terra, and TerraformGenerator.

When you specify a vanilla biome in validBiomesV2, the plugin automatically includes compatible custom biomes:

validBiomesV2:
- minecraft:plains
- minecraft:forest

This spawns structures in the vanilla biomes AND all custom biomes mapped to these types (e.g., terralith:blooming_plains).

Where the mappings actually live

The custom-biome to vanilla-biome mapping table is not stored in BetterStructures. It is a single hardcoded table inside MagmaCore, the shared library bundled into BetterStructures, and is shared with the other MagmaGuy plugins that need it.

That has two practical consequences:

  1. The long biome lists you see in the shipped generator_surface_*.yml files are generated output, not the source of truth. On load, BetterStructures reads validBiomesV2, looks up every minecraft: entry in the MagmaCore table, appends whatever custom biomes map to it, and then writes the expanded list straight back into the generator file. So a generator you wrote with two lines can come back with a hundred. Editing that expanded list only affects that one generator, and any minecraft: entry you leave in place will be re-expanded on the next load.
  2. Adding support for a new custom biome for everyone is a MagmaCore change, not a config change. If a world generator ships a biome that BetterStructures does not recognise, adding it to a generator's validBiomesV2 is a local workaround for that one generator. Getting it mapped properly means getting it added to MagmaCore's mapping table, which is a code change — open a request rather than trying to solve it in the yml files.

You can still name a custom biome directly in validBiomesV2 (anything already containing a : is taken as-is and is not expanded further), which is the right move for a one-off generator that should only spawn in one specific custom biome.

Biomes that MagmaCore maps to nothing are deliberately excluded — they are custom biomes considered unsuitable for structures, and no vanilla biome will pull them in.


treasureFilename

Sets the treasure file for chest loot. This applies to all builds using this generator, unless overridden in the schematic configuration.


generateLootInBarrels and barrelTreasureFilename

BetterStructures now treats barrels as a second loot container alongside chests.

  • generateLootInBarrels (default true) toggles whether barrels inside structures placed by this generator get filled. Set it to false to leave barrels untouched.
  • barrelTreasureFilename (default treasure_barrel_food.yml) selects which treasure file is rolled when filling those barrels. The default ships a lightweight food-focused loot table, but you can point it at any treasure file.

Both options can be overridden per-schematic with the matching barrelTreasureFilename field in the schematic config.