Hello there
I use OpenComputers to extract items from me AE2 network. I'm using an Adapter with a Database Upgrade in it, and this Adapter is adjacent to an ME Export bus and an ME Controller. I also suggest putting a Redstone Card in your ME Export Bus, so that it's only triggered by your Computer.
Here are some bits of code that could help you:
First, I load components:
local database = component.proxy(component.list("database")())
local meController = component.proxy(component.list("me_controller")())
local meExportBus = component.proxy(component.list("me_exportbus")())
Then I define some variables that are needed for the ME Controller and ME Export Bus drivers:
local exportBusSide
for i = 0, 5 do
if select(2, meExportBus.getConfiguration(i)) ~= "no export bus" then
exportBusSide = i
break
end
end
getConfiguration returns two variables, the second is "no export bus" or nil.
local databaseAddress
for k,_ in component.list("database") do databaseAddress = k break end
local entryNum = {}
for i = 1, 81 do
local item = database.get(i)
if item then entryNum[item.name] = i end
end
Here 81 needs to be changed to your Database size.
So now I get the list of items in the network:
local itemList = meController.getItemsInNetwork()
and loop through this table until I find the item I want using
for k, v in pairs(itemList) do
if v.name == "minecraft:dirt" then
Now you can use this function:
meExportBus.setConfiguration(exportBusSide, 1, databaseAddress, entryNum[v.name])
and this will have the same effect as you right clicking the ME Export Bus and dropping and item in it to configure it.
meExportBus.exportIntoSlot(exportBusSide, 1)
That will export exactly one item from your network, or more if you have Acceleration Cards in your ME Export Bus. If you want to export several items and want a precise output, a simple loop can do the work.
I also coudn't find much documentation on using AE2 with OC, and this is what I have came to after experimenting several hours. So if anyone has a way to optimize my code and setup, feel free to share what you have found
Have fun