All the Mods Factory Guide
SFM with AE2 and Mekanism

SFM with AE2 and Mekanism

What SFM 4.34 really knows about AE2 and Mekanism, powering an ME network from SFM, the ME Interface as SFM's way in and out of the network, driving AE2 inscribers, and running Mekanism machines by side with chemicals.

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

Versions: SFM 4.34.0 in all three packs, AE2 19.2.19 (ATM-10), 19.2.20 (All the Mons) and 26.1.13-beta (ATM-11), Mekanism 10.7.19 (not in ATM-11) measured · SFM source · issues

SFM reaches blocks through the standard item, fluid, energy and Mekanism chemical access, so it works with AE2 and Mekanism without special help. It does have a little special code for both, and some of it is switched off in 4.34.0, which changes what you’ll see in game. Read from SFM’s source (MPL-2.0) at the 1.21.1 tag, and from AE2’s and Mekanism’s. The language itself is on The SFM language. read

What SFM’s special code does, and doesn’t#

Code in SFM 4.34.0State
AE2 Energy Acceptor fix, so SFM can push FE into iton when AE2 is loaded
AE2 ME Interface seen as the whole networkwritten, but switched off (“will reintroduce it later once I figure out the performance characteristics”)
Mekanism chemicals (chemical::, and the gas::, slurry::, pigment::, infusion:: aliases)on
Mekanism energy in Joulesoff; use fe::
Warning for a Mekanism line with no side, or one that disagrees with the side configwritten, but switched off
Inspector that writes sided lines from a Mekanism machine’s side configwritten, but switched off
read

SFM and AE2#

Powering an ME network#

AE2’s Energy Acceptor holds no buffer and reports a capacity of zero, which on its own would stop SFM from moving FE into it. SFM works around that (#322), and its own test moves FE from a Mekanism energy cube into an acceptor: read

name "Power the ME network"

every tick do
    input fe:: from cube bottom side
    output fe:: to acceptor top side
end

A trigger that moves only fe:: may run every tick. Remember AE2 counts 2 FE per AE. read

The ME Interface: SFM’s way in and out#

With its whole-network view switched off, SFM sees an ME Interface the way every mod does: its 9 slots. How the interface treats those slots makes it a two-way door: read

  • Into the network: a slot with nothing set accepts anything, and the interface passes whatever lands there on into network storage. output to interface is a way to put SFM’s items into the ME system.
  • Out of the network: set a slot to an item, and the interface keeps it stocked from the network. input from interface then takes from that stock.

The same holds for fluids, and, with Applied Mekanistics, for Mekanism chemicals, since it gives interfaces a chemical slot too. estimate

When SFM beats AE2’s buses: one Factory Manager drives any number of machines by label, with each, retain and slot numbers, and it costs no channels. A bus handles one face and takes a channel. Let AE2 store and craft, and let SFM do the fiddly feeding. estimate

Worked example: AE2 inscribers#

SFM’s own tests drive a full processor line. An inscriber shows all four of its slots on every face (unless it’s set to separate sides): read

SlotHoldsAutomation can
0top plate (a press, or a printed circuit)insert while idle; not take out
1bottom plate (printed silicon)insert while idle; not take out
2middle inputinsert while idle; not take out
3outputalways take out; not insert

Put a press in slot 0 of each printing inscriber by hand. Label them logic, engineering, calculation and silicon (one inscriber or several each), the assembly inscribers assembly, and two chests materials and results: estimate

name "Processors"

every 20 ticks do
    input from materials
    output retain 2 gold_ingot to each logic slots 2
    output retain 2 diamond to each engineering slots 2
    output retain 2 certus_quartz_crystal to each calculation slots 2
    output retain 2 silicon to each silicon slots 2
    output retain 2 redstone to each assembly slots 2
    output retain 2 printed_silicon to each assembly slots 1
    output retain 2 printed_logic_processor, retain 2 printed_engineering_processor, retain 2 printed_calculation_processor to each assembly slots 0

    forget

    input from logic, engineering, calculation, silicon
    output to materials

    forget

    input from assembly
    output to results
end

The printed circuits go back to materials, so the first block feeds them on to the assembly inscribers. Only the output slot can be taken from, so the two input lines collect finished items and nothing else. An assembly inscriber takes whichever printed circuit arrives first, so give each processor type its own inscriber if you want one kind only. estimate

SFM and Mekanism#

Always name the side#

Mekanism answers by each face’s side configuration. A line with no side can read a Mekanism machine but can’t insert or extract, so it does nothing, and in 4.34.0 SFM doesn’t warn you. read Match each line to the face’s configured role:

  • a face set to output (or input/output): input ... from machine <face> side;
  • a face set to input: output ... to machine <face> side.

Faces are top, bottom, north, south, east, west, or relative left, right, front, back.

Energy#

Use fe:: for Mekanism power; SFM’s Joule type is switched off. Mekanism counts 2.5 J per FE, so an fe:: line of 1,000 moves 2,500 J. read

Worked example: chemicals for the ore chain#

SFM is a tidy way to keep the chemical inputs of a 5× chain topped up, the part that shouldn’t be encoded into AE2 patterns (see Mekanism and AE2). Label the tanks or plants acid, hcl and oxygen, and the machines dissolvers, injectors and purifiers; each machine’s top face is set to its chemical input, each plant’s bottom face to output: estimate

name "Ore chain chemicals"

every 20 ticks do
    input chemical::sulfuric_acid from acid bottom side
    output retain 4000 chemical::sulfuric_acid to each dissolvers top side

    forget

    input chemical::hydrogen_chloride from hcl bottom side
    output retain 4000 chemical::hydrogen_chloride to each injectors top side

    forget

    input chemical::oxygen from oxygen bottom side
    output retain 4000 chemical::oxygen to each purifiers top side
end

Chemical amounts are in millibuckets. retain 4000 ... to each keeps every machine’s chemical tank at up to 4,000 mB between runs. At base speed a machine uses about 1 mB a tick, so that’s plenty. Speed upgrades change it a lot at the packs’ upgrade multiplier: eight speed upgrades and no chemical upgrades use about 256 mB a tick, over 5,000 mB between runs. Add chemical upgrades, or raise the retain, if a machine runs dry. estimate

ATM-11#

ATM-11 has SFM and AE2 but no Mekanism. measured It runs SFM’s separate 26.1 build, which this page didn’t read, so which special code is on or off there may differ. The ME Interface behaviour comes from AE2, whose interface works the same way in 26.1. estimate

6 min readLicence