Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local me = peripheral.wrap("right")
- -- Functions
- function export(itemID, itemDmg, amt)
- if amt == nil then --if itemDmg isn't specified, amt will be nil and itemDmg will be the proper amt value
- amt = itemDmg --so put itemDmg into amt
- itemDmg = 0 --and use the default value for itemDmg
- end
- for number, item in pairs(list) do
- if item.fingerprint.id == itemID and item.fingerprint.dmg == itemDmg then
- while amt > 64 do
- me.exportItem(item.fingerprint, "SOUTH", amt)
- amt = amt - 64
- end
- me.exportItem(item.fingerprint, "SOUTH", amt)
- end
- end
- end
- function exportExcess(itemID, itemDmg, maxAmt)
- if maxAmt == nil then --if itemDmg isn't specified, maxAmt will be nil and itemDmg will be the proper maxAmt value
- maxAmt = itemDmg --so put itemDmg into maxAmt
- itemDmg = 0 --and use the default value for itemDmg
- end
- for number, item in pairs(list) do
- if item.fingerprint.id == itemID and item.fingerprint.dmg == itemDmg then
- if item.size > maxAmt then
- print("Condensing "..item.size-maxAmt.." "..itemID)
- export(itemID, itemDmg, item.size-maxAmt)
- end
- end
- end
- end
- -- Main code
- while true do
- term.clear()
- term.setCursorPos(1,1)
- list = me.getAvailableItems()
- exportExcess("minecraft:cobblestone", 500000)
- os.sleep(10)
- end
Add Comment
Please, Sign In to add comment