Skip to content

Worldgen and loot

These types add a mod’s features to biomes and its items to loot tables, each behind a switch the mod reads from its settings. Use them in place of each loader’s own biome modifiers and loot events, which differ between Fabric and Forge.

Type Summary Status Since Side Thread
BiomeFeatures Adds placed features to biomes. Experimental 2.1.0 both setup
LootAdditions Adds a pool to a loot table, or a chance to replace a brushed archaeology item. Experimental 2.1.0 both setup

The placed feature is the mod’s data/mymod/worldgen/placed_feature/maple.json. With mapleEnabled, a BooleanSupplier that reads the mod’s settings, in your mod’s common initializer:

Grow maples in every forest biome
ResourceKey<PlacedFeature> maple = ResourceKey.create(Registries.PLACED_FEATURE, id("maple"));
BiomeFeatures.add(maple, BiomeTags.IS_FOREST, GenerationStep.Decoration.VEGETAL_DECORATION,
mapleEnabled);

Experimental · Since 2.1.0 · Side: both · Thread: setup

BiomeFeatures adds a mod’s placed features, such as its trees, to the biomes a tag names, behind a switch the mod reads from its settings. A biome tag of the mod’s own lets data packs choose the biomes; its file is data/mymod/tags/worldgen/biome/has_maples.json. With maple and mapleEnabled as in the quick start:

Add maples to the biomes the mod's own tag lists
BiomeFeatures.add(maple, RegistryLookups.biomeTagKey(id("has_maples")),
GenerationStep.Decoration.VEGETAL_DECORATION, mapleEnabled);
  • A feature key with no placed feature in the server’s data fails when the server starts.
  • A mod ships no Forge biome modifier JSON: Stope’s Forge jar carries the one biome modifier every mod’s features go through.

Experimental · Since 2.1.0 · Side: both · Thread: setup

LootAdditions adds pools to loot tables and replacement items to archaeology loot, each behind a switch the mod reads from its settings. With MAPLE_SAPLING, the sapling’s Registered handle, and mapleEnabled as in the quick start:

Add maple saplings to plains village houses
LootAdditions.addPool(BuiltInLootTables.VILLAGE_PLAINS_HOUSE, () -> LootPool.lootPool()
.add(LootItem.lootTableItem(MAPLE_SAPLING.get()))
.when(LootItemRandomChanceCondition.randomChance(0.25f)), mapleEnabled);
Make 1 in 20 desert pyramid finds a maple sapling
LootAdditions.replaceBrushed(BuiltInLootTables.DESERT_PYRAMID_ARCHAEOLOGY, 0.05f,
random -> new ItemStack(MAPLE_SAPLING.get()), mapleEnabled);
  • A mod ships no Forge loot modifier JSON: Stope’s Forge jar carries the one global loot modifier every added pool goes through.
  • A LootAdditions#replaceBrushed addition whose roll hits but whose item is empty passes the brush on to the next addition for that table.
  • Brushed replacements work the same on Fabric and Forge.

Two Forge differences follow from Forge’s global loot modifiers:

  • On Forge a pool applies to the table the game rolled. A pool added to a table that another table reaches through a loot_table entry rolls on Fabric but not on Forge. Add pools to the table the game rolls; chest tables are rolled directly.
  • A data pack that replaces data/forge/loot_modifiers/global_loot_modifiers.json with "replace": true and leaves out stope:pools turns off every added pool on Forge.