Skip to main content

YAML definitions

Server owners and pack makers can define resources, recipes, machines and multiblocks without Java, in plugins/MachineEngine/definitions/.

  • Every *.yml file in that folder and its sub-folders is read, in path order (addons install theirs in sub-folders, e.g. definitions/mekanized/).
  • A file with enabled: false at the top is ignored.
  • A commented example.yml (disabled) is installed when the folder is first created.
  • Definitions are read after every addon, so they can use addons' resources, recipe types and behavior types.

A machine defined here is the machine type; the block players place is a CraftEngine block that points to it — see Blocks and items.

Reloading and errors​

WhatApplies
Recipes/machineengine reload recipes
Item tags, resource tags/machineengine reload tags
Resources, recipe types, machines, multiblocksRestart

An invalid entry is skipped, not fatal: everything else loads, and /machineengine report lists the skipped entry with its file and path.

A complete example​

An iron press: raw iron in, two iron ingots out, 20 J per tick.

plugins/MachineEngine/definitions/press.yml
recipe-types:
- mypack:pressing

machines:
mypack:iron_press:
storages:
input: {slots: 1, capacity: 64, filter: {item: minecraft:raw_iron}}
output: {slots: 1, capacity: 64}
energy: {capacity: 10000, filter: {type: machineengine:energy}}
ports:
in: {storage: input, direction: input, sides: [top, back]}
out: {storage: output, direction: output, sides: [bottom]}
power: {storage: energy, direction: input, sides: [left, right]}
upgrade-slots: 2
behavior:
type: machineengine:processing
recipes: mypack:pressing
inputs: [input]
output: output
costs: energy

recipes:
mypack:press_iron:
type: mypack:pressing
duration: 100
inputs:
- {item: minecraft:raw_iron, amount: 1}
outputs:
- {item: minecraft:iron_ingot, amount: 2}
cost-per-tick:
- {type: machineengine:energy, amount: 20}

Then a CraftEngine block for it, in your CraftEngine pack:

blocks:
mypack:iron_press:
template: machineengine:block/machine # the machine of the same id
settings: {template: default:settings/solid_1x1x1}
states:
template: machineengine:block_state/facing_active

Its menu is menus/machine.yml, or menus/mypack_iron_press.yml if you add one.

Machines​

machines:
<key>:
storages: {…}
ports: {…}
upgrade-slots: 0
catch-up: 0
behavior: {type: …, …}

storages​

What the machine holds, by id.

KeyDefaultMeaning
slots1Number of slots; each holds one resource.
capacity—Required. Per slot, in the resource's unit (items, mB, J…).
filteranyWhat fits — see filters.

A block can replace the capacity per block — see per-block numbers.

ports​

How neighbors, hoppers and cables reach the storages, by id.

KeyDefaultMeaning
storage—Required. The storage it gives access to.
directioninput_outputinput, output, input_output or disabled.
sidesallSides relative to the machine's facing: front, back, left, right, top, bottom.
filteranyWhat may pass.
rateno limitMost per tick.

Other keys​

KeyDefaultMeaning
upgrade-slots0Upgrade slots. Upgrade types come from addons; any of them fits.
catch-up0Ticks the machine catches up when its chunk loads again. 0: frozen while unloaded.
behavior—Required. What the machine does (below).

Behaviors​

machineengine:processing runs recipes:

KeyDefaultMeaning
recipes—Required. The recipe type it runs.
inputsnoneStorages inputs are taken from (a list, or one id). Empty for a generator.
output—Required. Storage the outputs go to.
costsnoneStorage(s) the per-tick costs are paid from.
pushnoneA side (front, back…) the output is pushed to, into the neighbor.
retry-ticks20With push: ticks between retries while the outputs do not fit (here or next door).

Inputs are taken when a process starts and held by the machine; cancelling a process gives them back. If a per-tick cost cannot be paid, the process pauses. If the outputs do not fit, it waits until they do.

machineengine:storage only stores (chests, tanks, batteries).

machineengine:multiblock_member is a block of a multiblock — see Multiblocks.

Addons register more behavior types; their documentation says what keys they take.

Recipes​

recipe-types:
- mypack:pressing # a type machines can run

recipes:
<key>:
type: mypack:pressing
duration: 100 # ticks, default 1
inputs: [<matcher>, …]
outputs: [<stack>, …]
chance-outputs: [{<stack>, chance: 0.25}, …]
cost-per-tick: [<stack>, …]
  • A matcher is a filter with an amount (default 1): { item: minecraft:raw_iron, amount: 2 }, { tag: mypack:hot_fluids, amount: 1000 }.
  • A stack is { item: <id>, amount: n } or { type: <resource>, amount: n }.
  • A chance output is a stack with chance between 0 and 1.

Tags and resources​

item-tags, resource-tags, resource-categories and resource-types — see Resources.

Multiblocks​

The multiblocks: section — see Multiblocks.