YAML definitions
Server owners and pack makers can define resources, recipes, machines and
multiblocks without Java, in plugins/MachineEngine/definitions/.
- Every
*.ymlfile 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: falseat 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ā
| What | Applies |
|---|---|
| Recipes | /machineengine reload recipes |
| Item tags, resource tags | /machineengine reload tags |
| Resources, recipe types, machines, multiblocks | Restart |
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.
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.
| Key | Default | Meaning |
|---|---|---|
slots | 1 | Number of slots; each holds one resource. |
capacity | ā | Required. Per slot, in the resource's unit (items, mB, Jā¦). |
filter | any | What 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.
| Key | Default | Meaning |
|---|---|---|
storage | ā | Required. The storage it gives access to. |
direction | input_output | input, output, input_output or disabled. |
sides | all | Sides relative to the machine's facing: front, back, left, right, top, bottom. |
filter | any | What may pass. |
rate | no limit | Most per tick. |
Other keysā
| Key | Default | Meaning |
|---|---|---|
upgrade-slots | 0 | Upgrade slots. Upgrade types come from addons; any of them fits. |
catch-up | 0 | Ticks 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:
| Key | Default | Meaning |
|---|---|---|
recipes | ā | Required. The recipe type it runs. |
inputs | none | Storages inputs are taken from (a list, or one id). Empty for a generator. |
output | ā | Required. Storage the outputs go to. |
costs | none | Storage(s) the per-tick costs are paid from. |
push | none | A side (front, backā¦) the output is pushed to, into the neighbor. |
retry-ticks | 20 | With 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
chancebetween 0 and 1.
Tags and resourcesā
item-tags, resource-tags, resource-categories and resource-types ā see
Resources.
Multiblocksā
The multiblocks: section ā see Multiblocks.