Skip to content

Conditions and Content Routing ​

Current API Minecraft 1.21.1 / MBD2 21.1.1
Named content display regions in the Recipe Viewer UI editor
`uiName` selects a display region; `slotName` independently routes to Trait handlers.
js
ServerEvents.recipes(event => {
  event.recipes.example.weather_machine()
    .id('example:weather_machine/storm_charge')
    .duration(400)
    .inputItems('minecraft:lightning_rod')
    .slotName('catalyst', r => r.inputItems('minecraft:amethyst_shard'))
    .uiName('main_output', r => r.outputItems('minecraft:creeper_spawn_egg'))
    .dimension('minecraft:overworld')
    .biome('minecraft:plains')
    .machineLevel(2)
    .positionY(64, 320)
    .raining(1, 15)
    .thundering(1, 15)
    .blocksInStructure(4, 16, 'minecraft:copper_block')
    .machineData({ mode: 'storm' }, true)
    .dayTime(false)
    .light(0, 15, 0, 15, true)
    .redstoneSignal(1, 15)
})
ModifierMatchesCommon mistake
slotNameA recipe slot name exposed by a Trait definitionSupplying the Trait name
uiNameA Recipe Viewer UI content element nameTreating it as storage routing
machineData(data, true)machine.customData onlyConfusing it with recipe data
blocksInStructureBlock counts in a formed structureExpecting a world scan on single machines

Use recipe conditions instead of reimplementing dimensions, weather, or redstone checks in onTick.

Released under the MIT License.