All the Mods Factory Guide
The SFM language

The SFM language

Triggers, resource types, sides, filters, slots, and the keywords that control flow (retain, each, forget, round robin, if).

Applies to: ATM-10 8.6 · All the Mons 2.2.0 · ATM-11 0.16.0-beta

Checked against SFM 4.34.0’s grammar (SFML.g4) and the TheVoos tutorial. The in-game editor marks mistakes as you type, and View Examples in the manager shows working programs. read

Shape of a program#

name "My First Program"
-- two dashes start a comment

every 20 ticks do
    input from barrel
    output to chest
end

A program is a name, then one or more triggers, each holding input and output lines and closed with end. Indentation is only for reading.

Triggers#

TriggerRuns
every 20 ticks doOnce a second. 20 ticks is the minimum for items, fluids and chemicals.
every tick do20 times a second, only if every line in that trigger moves fe::. One item line brings back the 20-tick floor.
every redstone pulse doWhen the manager gets a redstone pulse.
every 20 global ticks doIn step with the world clock, so several managers line up. Offsets like 20g+5 are allowed.

Both minimums are server settings (timerTriggerMinimumIntervalInTicks, and its FE-only twin), so a server may differ. read

Resource types#

Without a prefix, a line moves items.

TypePrefixNotes
Itemsitem:: (optional)
Energyfe:: (also rf::, energy::, power::)The source must have its own buffer: an energy cube or cell.
Fluidsfluid::Amounts in millibuckets: input 10 fluid::water from sink.
Mekanism chemicalschemical::On 1.21.1, gas::, slurry::, pigment:: and infusion:: are all aliases for chemical::.
Redstoneredstone::

Sides#

Many machines, including Mekanism’s and furnaces, ignore access with no side given. Name the face:

input fe:: from source bottom side
output fe:: to cube top side

Faces: top, bottom, north, south, east, west. Relative faces: left, right, front, back. Also each side, and null, the default. SFM warns about Mekanism lines with no side. A composter with no side acts as a trash can. read

Filters#

FilterMatches
cobblestoneAny mod’s cobblestone. A bare name matches every namespace, not just minecraft:.
minecraft:cobblestoneExactly that item.
mekanism:*Everything from one mod.
*stone*Anything with “stone” in its name. A quoted string is a full regular expression.
except *stone*Everything else.
with tag c:raw_materials or with #c:raw_materialsItems with that tag. Combine with and, or, not, and without.

To see an item’s tags, press F3+H for advanced tooltips and hold Ctrl over the item.

Amounts and slots#

  • input 10 cobblestone from barrel: at most 10 per run.
  • output to chest slots 13 or slots 13-15: only those slots. Find their numbers with Ctrl+I.
  • empty slots in: aims at empty slots only.

Flow keywords#

KeywordEffect
retain 5On input: leave 5 behind. On output: fill the target only up to 5.
eachApplies a limit or retain to every block with the label, not to the group as a whole: output retain 1 to each chamber.
forgetDrops the inputs gathered so far, so the next lines start clean. Put it between unrelated moves.
OrderLines run top to bottom. An earlier output gets first pick, and later ones take the overflow.
round robin by blockSpreads items across every block with the label in turn.
round robin by labelSpreads across a list of labels: output to a, b round robin by label.

Conditions#

if chest has >= 1 iron_ingot and orb has = 0 then
    input 1 iron_ingot from chest
    output to orb
else if chest has >= 1 blaze_rod then
    input 1 blaze_rod from chest
    output to orb
else
    forget
end

Comparisons: >, >=, =, <, <= (or gt, ge, eq…), joined with and, or and not. read

Sources: the grammar, server config, Mekanism compat, and the video at 2:55 (triggers), 7:25 (sides), 14:50 (filters) and 19:23 (retain).

4 min readLicence