Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- AEAutoCraft
- -- Written by Henry Link for minecraft 1.6.4 (DW20 pack)
- -- Original pastebin aTvRPuJt
- -- Processing indicators
- -- Use a redstone signal to trigger lamps on/off to indicate if something is being made
- rl = "left" -- rl = red lamp - turns on when there is crafting in progress
- gl = "right" -- gl = green lamp - turns on when there is no crafting
- redstone.setOutput(gl, true)
- -- Peripheral wrap the crafting terminal
- -- Note this could be almost any AE block
- cm = peripheral.wrap("bottom")
- -- Define the array of items you want to keep in stock
- -- qty is the amount to be made
- -- stock is the amount to kept in stock
- -- current needs to be defined but the scanCurrent function will fill that data with current inventory numbers
- itemList = {}
- itemList[1] = {["name"] = "Glass", ["id"] = 20, ["dmg"] = 0, ["qty"] = 0, ["stock"] = 256, ["current"] = 0}
- itemList[2] = {["name"] = "Nether Quartz Dust", ["id"] = 4362, ["dmg"] = 22, ["qty"] = 0, ["stock"] = 128, ["current"] = 0}
- itemList[3] = {["name"] = "Silicon", ["id"] = 4362, ["dmg"] = 13, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[4] = {["name"] = "Basic Processor", ["id"] = 4362, ["dmg"] = 18, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[5] = {["name"] = "Advanced Processor", ["id"] = 4362, ["dmg"] = 19, ["qty"] = 0, ["stock"] = 16, ["current"] = 0}
- itemList[6] = {["name"] = "Fluix Dust", ["id"] = 4362, ["dmg"] = 14, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[7] = {["name"] = "Fluix Crystal", ["id"] = 4362, ["dmg"] = 23, ["qty"] = 0, ["stock"] = 16, ["current"] = 0}
- itemList[8] = {["name"] = "Fluix Pearl", ["id"] = 4362, ["dmg"] = 24, ["qty"] = 0, ["stock"] = 16, ["current"] = 0}
- itemList[9] = {["name"] = "Conversion Matix", ["id"] = 4362, ["dmg"] = 0, ["qty"] = 0, ["stock"] = 16, ["current"] = 0}
- itemList[10] = {["name"] = "ME Cable", ["id"] = 852, ["dmg"] = 14, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[11] = {["name"] = "Blank Pattern", ["id"] = 4362, ["dmg"] = 16, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[12] = {["name"] = "ME Interface", ["id"] = 851, ["dmg"] = 8, ["qty"] = 0, ["stock"] = 16, ["current"] = 0}
- itemList[13] = {["name"] = "ME Basic Import Bus", ["id"] = 853, ["dmg"] = 3, ["qty"] = 0, ["stock"] = 8, ["current"] = 0}
- itemList[14] = {["name"] = "ME Basic Export Bus", ["id"] = 853, ["dmg"] = 2, ["qty"] = 0, ["stock"] = 8, ["current"] = 0}
- itemList[15] = {["name"] = "ME Precision Export Bus", ["id"] = 852, ["dmg"] = 0, ["qty"] = 0, ["stock"] = 4, ["current"] = 0}
- itemList[16] = {["name"] = "ME Storage Bus", ["id"] = 852, ["dmg"] = 9, ["qty"] = 0, ["stock"] = 4, ["current"] = 0}
- itemList[17] = {["name"] = "Blizz Powder", ["id"] = 20264, ["dmg"] = 1025, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[18] = {["name"] = "Pyrotheum Dust", ["id"] = 20264, ["dmg"] = 165, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[19] = {["name"] = "Resonant Ender Bucket", ["id"] = 20259, ["dmg"] = 2, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[20] = {["name"] = "Pulverized Tin", ["id"] = 20264, ["dmg"] = 33, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[21] = {["name"] = "Cinnabar", ["id"] = 20264, ["dmg"] = 130, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[22] = {["name"] = "Pulverized Shiny Metal", ["id"] = 20264, ["dmg"] = 33, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[23] = {["name"] = "Enderium Blend", ["id"] = 20264, ["dmg"] = 42, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[24] = {["name"] = "Enderium Ingot", ["id"] = 20264, ["dmg"] = 74, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[25] = {["name"] = "Pulverized Obsidian", ["id"] = 20264, ["dmg"] = 3, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[26] = {["name"] = "Hardened Glass", ["id"] = 2013, ["dmg"] = 0, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[27] = {["name"] = "Redstone Energy Conduit", ["id"] = 20278, ["dmg"] = 2, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[28] = {["name"] = "Impulse Itemduct", ["id"] = 20278, ["dmg"] = 4098, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[29] = {["name"] = "Fluiduct", ["id"] = 20278, ["dmg"] = 2048, ["qty"] = 0, ["stock"] = 32, ["current"] = 0}
- itemList[30] = {["name"] = "Pneumatci Servo", ["id"] = 20264, ["dmg"] = 192, ["qty"] = 0, ["stock"] = 4, ["current"] = 0}
- itemList[31] = {["name"] = "Pulverized Coal", ["id"] = 20264, ["dmg"] = 2, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- itemList[32] = {["name"] = "Steel Ingot", ["id"] = 7798, ["dmg"] = 0, ["qty"] = 0, ["stock"] = 128, ["current"] = 0}
- itemList[33] = {["name"] = "Steel Plate", ["id"] = 7802, ["dmg"] = 1, ["qty"] = 0, ["stock"] = 64, ["current"] = 0}
- -- Get the current inventory and place it into the array
- function scanCurrent()
- for i, data in pairs(itemList) do
- -- c is the current count of the item we are currently on in the array
- c = cm.countOfItemType(itemList[i]["id"],itemList[i]["dmg"])
- -- Store it back into the array
- itemList[i]["current"] = c
- --print(itemList[i]["name"].. " = " .. c)
- end
- end
- -- Main loop
- while true do
- -- Scan our inventory
- print("Scanning Inventory...")
- sleep(2)
- scanCurrent()
- -- Now loop through each item and see if anything needs to be crafted
- for i, data in pairs(itemList) do
- if itemList[i]["current"] < itemList[i]["stock"] then
- -- Found an item the needs crafting. Figure out how many
- itemList[i]["qty"] = itemList[i]["stock"] - itemList[i]["current"]
- print("Need to make " .. itemList[i]["qty"] .. " of " .. itemList[i]["name"])
- -- Trigger AE to craft it
- cm.requestCrafting(itemList[i])
- redstone.setOutput(gl, false)
- redstone.setOutput(rl, true)
- -- Display crafting status and wait for the item to complete
- while itemList[i]["current"] < itemList[i]["stock"] do
- c = cm.countOfItemType(itemList[i]["id"],itemList[i]["dmg"])
- itemList[i]["current"] = c
- sleep(4)
- print(" Waiting for " .. itemList[i]["stock"] - itemList[i]["current"] .. " of " .. itemList[i]["name"] .. " to be made")
- end
- redstone.setOutput(gl, true)
- redstone.setOutput(rl, false)
- end
- end
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement