This page documents the OpenComputers API exposed by the Applied Energistics 2 integration. It covers stationary ME network components, bus and interface configuration, interface terminal pattern transfer, crafting control, network monitoring, and the robot or drone AE upgrade.
- Dependency:
appeng - Label:
integration-required
me_controllerme_exportbusme_importbusme_storagebusme_interfaceme_interface_terminalupgrade_me
Most item-oriented callbacks return or accept item tables based on the standard OpenComputers item converter. Common fields include:
name: registry name such asminecraft:iron_ingotlabel: localized display namedamage: metadata / damage valuesize: stack sizemaxSize: maximum stack sizemaxDamage: maximum durabilityhasTag: whether the stack has NBTid: numeric item id when OC is configured to include idsoreNames: ore dictionary names when OC is configured to include themenchantments,lore,tagwhen present and allowed by OC settings
AE item tables also include:
isCraftable: whether the entry represents a craftable target
Common fluid fields include:
name: internal fluid name such aswaterlabel: localized fluid nameamount: millibucketshasTag: whether the fluid stack has NBTid: numeric fluid id when OC is configured to include ids
AE fluid tables also include:
size: AE stack sizeisCraftable: whether the entry represents a craftable target
The interface terminal uses location tables with these fields:
xyzdimIdoptional, defaults to the terminal dimension
getInterfacePattern returns the encoded pattern item stack.
Its converted data typically includes:
inputs: array of input item stacksoutputs: array of output item stacksisCraftable: whether the pattern is a crafting pattern
These callbacks are available on me_controller and on upgrade_me while it is successfully linked to an AE network.
- Syntax:
me.getCpus() - Returns: array of CPU descriptor tables
- Purpose: lists all AE crafting CPUs visible to the network
Each descriptor usually contains:
namestoragecoprocessorsbusycpu: userdata handle for detailed CPU inspection
Example:
for _, info in ipairs(component.me_controller.getCpus()) do
print(info.name, info.storage, info.busy)
end- Syntax:
me.getCraftables([filter]) - Parameters:
filter: optional table matched against converted craftable output fields
- Returns: array of
Craftableuserdata values - Purpose: lists recipes that the network knows how to craft
The filter is exact-match on converted fields after string or numeric normalization.
Useful keys are usually name, label, damage, and sometimes id.
Example:
local craftables = component.me_controller.getCraftables({label = "Printed Silicon"})
print(#craftables)- Syntax:
me.getCraftable(detail, type) - Parameters:
detail: descriptor table for one AE stack identitytype: registered AE stack type id
- Returns:
Craftableuserdata ornil - Purpose: resolves one known craftable recipe target directly
Usage notes:
- The source parses
detailthrough the registered AE stack parser for the suppliedtype. - In normal AE2 item networks,
typeis typically the item stack type id. - Additional integrations can register other AE stack types, so this callback is more general than a plain item-only lookup.
Example:
local craftable = component.me_controller.getCraftable(
{name = "minecraft:glass", damage = 0, size = 1},
"item"
)- Syntax:
me.getItemsInNetwork([filter]) - Parameters:
filter: optional item filter table
- Returns: array of converted item tables
- Purpose: lists stored items currently present in the network
Example:
local items = component.me_controller.getItemsInNetwork({name = "minecraft:iron_ingot"})
for _, stack in ipairs(items) do
print(stack.label, stack.size)
end- Syntax:
me.getItemInNetwork(nameOrId[, damage[, nbtJson]]) - Syntax:
me.getItemInNetwork(detail) - Parameters:
nameOrId: registry name string or numeric item iddamage: optional metadata, defaults to0nbtJson: optional SNBT string, defaults to{}detail: item descriptor table parsed through the registered AE item stack parser
- Returns: converted item table or
nil - Purpose: looks up one exact stored item variant
Usage notes:
- The string/id form builds a temporary
ItemStackand parses the third argument with Minecraft's SNBT parser. - The table form is the current source-backed path for callers that already have a converted descriptor table.
- Exact lookups therefore no longer need to be expressed only as name plus damage plus NBT text.
Example:
local stack = component.me_controller.getItemInNetwork("minecraft:wool", 14)
if stack then
print(stack.label, stack.size)
endlocal exact = component.me_controller.getItemInNetwork({
name = "minecraft:wool",
damage = 14,
size = 1
})- Syntax:
me.getItemsInNetworkById(filterIds) - Parameters:
filterIds: array of registry names or numeric item ids
- Returns: array of converted item tables
- Purpose: fetches all stored item entries whose base item matches one of the supplied ids
This filters by item type only, not by metadata or NBT.
Example:
local items = component.me_controller.getItemsInNetworkById({
"minecraft:cobblestone",
"minecraft:stone"
})- Syntax:
me.getFluidInNetwork([name]) - Syntax:
me.getFluidInNetwork(detail) - Parameters:
name: optional fluid name such aswaterdetail: fluid descriptor table parsed through the registered AE fluid stack parser
- Returns: converted fluid table or
nil - Purpose: looks up one fluid type in the network
Usage notes:
- The descriptor-table form mirrors the item lookup path and is the current source-backed way to do exact fluid lookups from previously converted values.
- If the named fluid does not exist, the callback returns
nil.
Example:
local water = component.me_controller.getFluidInNetwork("water")
print(water and water.amount or 0)local fluid = component.me_controller.getFluidInNetwork({name = "water", amount = 1})- Syntax:
me.allItems() - Returns: iterator userdata
- Purpose: iterates through network items without building one huge Lua table up front
The iterator returns one converted item entry per call until it returns nil.
This is useful on very large AE networks.
Example:
local it = component.me_controller.allItems()
while true do
local stack = it()
if not stack then break end
print(stack.label, stack.size)
end- Syntax:
me.store(filter, databaseAddress[, startSlot[, count]]) - Parameters:
filter: item filter tabledatabaseAddress: target database component addressstartSlot: optional one-based first database slot, defaults to1count: optional maximum number of entries to copy
- Returns:
true - Purpose: copies matching item descriptors from the network into a database
The method skips occupied database slots until it finds empty ones.
Example:
local ok = component.me_controller.store(
{label = "Iron Ingot"},
database.address,
1,
8
)- Syntax:
me.getFluidsInNetwork() - Returns: array of converted fluid tables
- Purpose: lists fluids visible to the AE network
Some hidden or virtual fluid entries are filtered out by compatibility helpers.
Example:
for _, fluid in ipairs(component.me_controller.getFluidsInNetwork()) do
print(fluid.label, fluid.amount)
end- Syntax:
me.getAvgPowerInjection() - Returns: number
- Purpose: reports average AE power input
- Syntax:
me.getAvgPowerUsage() - Returns: number
- Purpose: reports average AE power consumption
- Syntax:
me.getIdlePowerUsage() - Returns: number
- Purpose: reports idle AE power draw
- Syntax:
me.getMaxStoredPower() - Returns: number
- Purpose: reports AE network energy capacity
- Syntax:
me.getStoredPower() - Returns: number
- Purpose: reports currently stored AE energy
Example:
local me = component.me_controller
print(me.getStoredPower(), "/", me.getMaxStoredPower())- Syntax:
me.setFluidEventSubscription(enabled) - Parameters:
enabled: boolean
- Returns: nothing
- Purpose: subscribes or unsubscribes from
network_fluid_changed
When enabled, the component sends a computer signal whose first argument is the event name and whose remaining arguments are converted fluid entries that changed. Changed entries are recursively serialized through NBT before dispatch, so signal payloads contain Lua-safe data rather than live AE stack objects.
- Syntax:
me.isFluidEventSubscription() - Returns: boolean
- Purpose: checks whether fluid change subscription is enabled
- Syntax:
me.setItemEventSubscription(enabled) - Parameters:
enabled: boolean
- Returns: nothing
- Purpose: subscribes or unsubscribes from
network_item_changed
- Syntax:
me.isItemEventSubscription() - Returns: boolean
- Purpose: checks whether item change subscription is enabled
Changed item entries are recursively serialized through NBT before dispatch. Treat the received values as ordinary Lua tables and scalar values; do not depend on Java or AE userdata surviving in the signal payload.
Example:
local event = require("event")
local me = component.me_controller
me.setItemEventSubscription(true)
local _, _, changed = event.pull("network_item_changed")
print(changed.label, changed.size)me_controller exposes the shared network control callbacks listed above.
Use it when you want a stationary machine to inspect or automate an AE network directly.
me_exportbus configures an AE export bus on a multipart host.
All bus directions are regular Forge sides 0 through 5.
Configuration slots use one-based Lua indices. Omitting slot selects slot 1; pass 1, not 0, for the first slot.
- Syntax:
bus.getExportConfiguration(side[, slot]) - Parameters:
side: side the export bus is installed onslot: optional one-based configuration slot, defaults to1
- Returns: configured item descriptor table or
nil - Purpose: reads one export filter slot
- Syntax:
bus.setExportConfiguration(side[, slot][, databaseAddress, entry]) - Syntax:
bus.setExportConfiguration(side[, slot][, detail]) - Parameters:
side: bus sideslot: optional one-based configuration slot, defaults to1databaseAddress,entry: copy an item descriptor from a databasedetail: direct item descriptor table
- Returns:
true - Purpose: sets or clears one export filter slot
Omitting the descriptor clears the slot.
- Syntax:
bus.getExportSlotSize(side) - Returns: number
- Purpose: returns how many config slots are currently usable
The result depends on installed AE capacity upgrades.
- Syntax:
bus.getExportOreFilter(side) - Returns: string
- Purpose: reads the ore dictionary filter string
- Syntax:
bus.setExportOreFilter(side, filter) - Parameters:
filter: ore dictionary name or filter string accepted by AE2
- Returns:
true - Purpose: changes the export bus ore filter
- Syntax:
bus.exportIntoSlot(side, slot) - Parameters:
side: bus sideslot: one-based target inventory slot on the adjacent inventory
- Returns:
trueon success,falsewhen nothing was exported, ornil, "no inventory"when no adjacent inventory exists - Purpose: performs one immediate export attempt into a specific inventory slot
The call pauses for about 0.25 seconds after a successful transfer burst.
Example:
local bus = component.me_exportbus
bus.setExportConfiguration(sides.north, 1, {name = "minecraft:glass"})
print(bus.exportIntoSlot(sides.north, 1))me_importbus configures an AE import bus on a multipart host.
Configuration slots use one-based Lua indices. Omitting slot selects slot 1; pass 1, not 0, for the first slot.
- Syntax:
bus.getImportConfiguration(side[, slot]) - Returns: configured item descriptor table or
nil - Purpose: reads one import filter slot
- Syntax:
bus.setImportConfiguration(side[, slot][, databaseAddress, entry]) - Syntax:
bus.setImportConfiguration(side[, slot][, detail]) - Returns:
true - Purpose: sets or clears one import filter slot
- Syntax:
bus.getImportSlotSize(side) - Returns: number
- Purpose: returns the number of usable import filter slots
- Syntax:
bus.getImportOreFilter(side) - Returns: string
- Purpose: reads the ore dictionary filter string
- Syntax:
bus.setImportOreFilter(side, filter) - Returns:
true - Purpose: changes the ore dictionary filter
Example:
local bus = component.me_importbus
bus.setImportConfiguration(sides.up, 1, {name = "minecraft:clay_ball"})
print(bus.getImportSlotSize(sides.up))me_storagebus configures an AE storage bus on a multipart host.
Configuration slots use one-based Lua indices. Omitting slot selects slot 1; pass 1, not 0, for the first slot.
- Syntax:
bus.getStorageConfiguration(side[, slot]) - Returns: configured item descriptor table or
nil - Purpose: reads one storage bus filter slot
- Syntax:
bus.setStorageConfiguration(side[, slot][, databaseAddress, entry]) - Syntax:
bus.setStorageConfiguration(side[, slot][, detail]) - Returns:
true - Purpose: sets or clears one storage bus filter slot
- Syntax:
bus.getStorageOreFilter(side) - Returns: string
- Purpose: reads the storage bus ore filter
- Syntax:
bus.setStorageOreFilter(side, filter) - Returns:
true - Purpose: changes the storage bus ore filter
- Syntax:
bus.getStorageSlotSize(side) - Returns: number
- Purpose: returns the number of usable configuration slots
Storage buses start with more slots than import or export buses, and capacity upgrades increase the limit further.
me_interface is exposed for both full AE interface blocks and multipart interfaces.
Block interfaces omit the leading side argument.
Multipart interfaces require it.
Configuration slots use one-based Lua indices. Omitting slot selects slot 1; pass 1, not 0, for the first slot.
- Syntax:
iface.getInterfaceConfiguration([slot]) - Syntax:
iface.getInterfaceConfiguration(side[, slot]) - Parameters:
slot: optional one-based configuration slot, defaults to1
- Returns: item descriptor table or
nil - Purpose: reads one interface config slot
- Syntax:
iface.setInterfaceConfiguration([slot][, databaseAddress, entry[, size]]) - Syntax:
iface.setInterfaceConfiguration([slot][, detail]) - Syntax:
iface.setInterfaceConfiguration(side[, slot][, databaseAddress, entry[, size]]) - Syntax:
iface.setInterfaceConfiguration(side[, slot][, detail]) - Returns:
true - Purpose: sets or clears one interface config slot
Clearing is done by omitting the descriptor argument.
- Syntax:
iface.getInterfacePattern([slot]) - Syntax:
iface.getInterfacePattern(side[, slot]) - Parameters:
slot: one-based pattern slot, defaults to1
- Returns: encoded pattern item stack or
nil - Purpose: reads one stored pattern from the interface
- Syntax:
iface.setInterfacePatternInput(slot, index[, databaseAddress, entry, size]) - Syntax:
iface.setInterfacePatternInput(slot, index[, detail, type]) - Purpose: overwrites one pattern input entry
Parameters:
slot: one-based pattern slot inside the interfaceindex: one-based input index inside the encoded patterndatabaseAddress,entry,size: source database entrydetail: item or fluid descriptor tabletype: AE stack type id such as the registered item or fluid type
Returns true on success.
If no replacement descriptor is supplied, the selected entry is cleared.
Failure cases:
- invalid interface slot
- invalid pattern index
- no encoded pattern in the selected slot
- unknown AE stack type
- Syntax:
iface.setInterfacePatternOutput(slot, index[, databaseAddress, entry, size]) - Syntax:
iface.setInterfacePatternOutput(slot, index[, detail, type]) - Returns:
true - Purpose: overwrites one pattern output entry
Behavior is the same as setInterfacePatternInput, but it edits the output list.
- Syntax:
iface.storeInterfacePatternInput(slot, index, databaseAddress, entry) - Returns:
true - Purpose: copies one pattern input entry into a database slot
The copied stack is normalized to size 1.
- Syntax:
iface.storeInterfacePatternOutput(slot, index, databaseAddress, entry) - Returns:
true - Purpose: copies one pattern output entry into a database slot
- Syntax:
iface.clearInterfacePatternInput(slot, index) - Returns:
true - Purpose: removes one input entry from a block interface pattern
This callback exists only on block interfaces.
- Syntax:
iface.clearInterfacePatternOutput(slot, index) - Returns:
true - Purpose: removes one output entry from a block interface pattern
This callback exists only on block interfaces.
Example:
local iface = component.me_interface
local pattern = iface.getInterfacePattern(1)
if pattern then
print(pattern.label)
endme_interface_terminal discovers interfaces visible to the AE network and moves encoded patterns between them.
- Syntax:
term.getInterfaces() - Returns: iterator userdata
- Purpose: snapshots all visible interfaces
- Syntax:
term.getInterfacesByName(filter) - Parameters:
filter: exact display name
- Returns: iterator userdata
- Purpose: snapshots interfaces whose displayed name matches exactly
- Syntax:
term.getInterfacesByLocation(location[, side]) - Parameters:
location: table withx,y,z, and optionaldimIdside: optional numeric or string Forge side
- Returns: iterator userdata
- Purpose: snapshots interfaces at one exact location
- Syntax:
term.send(source, target) - Parameters:
source: table withlocation, optionalside, and requiredslottarget: table withlocation, optionalside, and optionalslot
- Returns:
true, sloton success orfalse, error - Purpose: moves one encoded pattern from one interface to another
If target.slot is omitted, the first empty target slot is used.
Common errors:
Source slot cannot be emptySource slot out of boundsCan't find source patternTarget slot out of boundsTarget slot is not emptyNo empty slot in target machineSource machine not foundTarget machine not foundBoth machines not found
- Syntax:
term.sendBatch(tasks) - Parameters:
tasks: array of{source = ..., target = ...}tables
- Returns: array of result tuples in the same order as the input tasks
- Purpose: performs multiple transfers in one call
The userdata returned by the three discovery callbacks exposes the following behaviors.
- Syntax:
iterator() - Returns: one interface record, then the next one on each call, and finally
nil - Purpose: sequential iteration
Each record contains:
namelocationsidepatterns: map of zero-based pattern slot index to pattern stack when pattern inclusion is enabled
- Syntax:
iterator(index) - Parameters:
index: one-based record index
- Returns: the matching interface record or
nil - Purpose: random access into the snapshot
- Syntax:
iterator("n") - Returns: number
- Purpose: returns the snapshot length using the userdata call operator
- Syntax:
iterator.reset() - Returns: nothing
- Purpose: rewinds sequential iteration
- Syntax:
iterator.count() - Returns: number
- Purpose: returns the number of interfaces in the snapshot
- Syntax:
iterator.getAll([includePatterns]) - Parameters:
includePatterns: optional boolean, defaults tofalse
- Returns: array of all interface records
- Purpose: materializes the entire snapshot into Lua
getAll(true) can be expensive on large networks because every pattern inventory is serialized at once.
Example:
local term = component.me_interface_terminal
local interfaces = term.getInterfaces()
print("visible:", interfaces.count())
local first = interfaces(1)
if first then
print(first.name, first.location.x, first.location.y, first.location.z)
endupgrade_me is the AE upgrade installed in a robot or drone.
Besides the shared network callbacks, it also provides direct item and fluid transfer with the currently selected inventory slot or tank.
The upgrade must be linked to an AE security terminal and be within wireless range of a valid AE wireless access point.
- Syntax:
up.sendItems([amount]) - Parameters:
amount: optional maximum item count, default64
- Returns: number of items actually inserted
- Purpose: sends items from the selected inventory slot into the AE network
If the selected slot is empty or the upgrade is not linked, the result is 0.
- Syntax:
up.requestItems(databaseAddress, entry[, amount]) - Syntax:
up.requestItems(detail) - Parameters:
databaseAddress,entry: database item descriptoramount: optional request amountdetail: item descriptor table with at leastnameorid, and optionaldamageandsize
- Returns: number of items actually extracted
- Purpose: pulls matching items into the selected inventory slot
Important behavior:
- if the selected slot already contains a different item type, the result is
0 - when no size is supplied, the request grows to the largest legal stack for that slot
- extraction is capped by the selected slot's remaining free space
- Syntax:
up.sendFluids([amount]) - Parameters:
amount: optional maximum millibuckets, defaults to the tank content or capacity limit
- Returns: number of millibuckets actually inserted
- Purpose: sends fluid from the selected tank into the AE network
- Syntax:
up.requestFluids(databaseAddress, entry[, amount]) - Syntax:
up.requestFluids(detail) - Parameters:
databaseAddress,entry: database entry describing a filled fluid containeramount: optional millibucketsdetail: fluid descriptor table with at leastnameorid, and optionalsize
- Returns: number of millibuckets actually extracted
- Purpose: fills the selected tank from the AE network
When no size is given in a direct detail table, the default request amount is one bucket, 1000 mB.
- Syntax:
up.isLinked() - Returns: boolean
- Purpose: reports whether the upgrade can currently reach its linked AE network
Example:
local me = component.upgrade_me
if me.isLinked() then
print("sent", me.sendItems(16))
endReturned by getCraftable and getCraftables.
- Syntax:
craftable.getStack() - Returns: converted item table
- Purpose: returns the recipe output represented by this craftable handle
- Syntax:
craftable.request([amount[, prioritizePower[, cpuName]]]) - Parameters:
amount: optional number of output items to craft, defaults to1prioritizePower: optional boolean, defaults totruecpuName: optional exact crafting CPU name
- Returns:
CraftingStatususerdata, ornil, "no controller"when the source controller is gone - Purpose: starts an asynchronous AE crafting request
The request is computed asynchronously first, then submitted to the network. Typical failure reasons later reported through the status object include missing resources or internal AE submission errors.
Returned in each getCpus descriptor under the cpu field.
- Syntax:
cpu.cancel() - Returns: boolean
- Purpose: cancels the current job running on that CPU
Returns false when the CPU is not busy.
- Syntax:
cpu.isActive() - Returns: boolean
- Purpose: checks whether the CPU cluster is currently active
- Syntax:
cpu.isBusy() - Returns: boolean
- Purpose: checks whether the CPU currently has a job assigned
- Syntax:
cpu.activeItems() - Returns: array of converted AE stack tables
- Purpose: lists items currently being crafted
- Syntax:
cpu.pendingItems() - Returns: array of converted AE stack tables
- Purpose: lists items still waiting to be processed
- Syntax:
cpu.storedItems() - Returns: array of converted AE stack tables
- Purpose: lists items already stored inside the crafting job buffer
- Syntax:
cpu.finalOutput() - Returns: output stack table, or
nil, "No crafting monitor", ornil, "Nothing is crafted" - Purpose: reads the final crafting monitor output if the CPU cluster has one
Returned by Craftable.request.
- Syntax:
status.isComputing() - Returns: boolean
- Purpose: checks whether AE is still computing the crafting plan
- Syntax:
status.hasFailed() - Returns:
boolean, reason - Purpose: reports whether the request failed and why
Typical reasons look like request failed (missing resources) or another submission error string.
- Syntax:
status.isCanceled() - Returns:
boolean[, reason] - Purpose: checks whether the crafting link was canceled
While the request is still being computed, the method returns false, "computing".
- Syntax:
status.isDone() - Returns:
boolean[, reason] - Purpose: checks whether the crafting request completed
While the request is still being computed, the method returns false, "computing".
local component = require("component")
local event = require("event")
local me = component.me_controller
print("Power:", me.getStoredPower(), "/", me.getMaxStoredPower())
for _, stack in ipairs(me.getItemsInNetwork({label = "Iron Ingot"})) do
print(stack.label, stack.size)
end
local craftables = me.getCraftables({label = "Printed Silicon"})
if #craftables > 0 then
local status = craftables[1].request(1, true)
while status.isComputing() do
os.sleep(0.1)
end
print("done:", status.isDone())
end
me.setItemEventSubscription(true)
local _, _, changed = event.pull(1, "network_item_changed")
if changed then
print("changed:", changed.label, changed.size)
endae2fcthaumicenergisticsopencomputers-data-card