SHOW:
|
|
- or go back to the newest paste.
| 1 | -- Variables | |
| 2 | ||
| 3 | local me = peripheral.wrap("right")
| |
| 4 | - | local list = me.getAvailableItems() |
| 4 | + | |
| 5 | - | local itemID = "" |
| 5 | + | |
| 6 | - | local amt = 0 |
| 6 | + | |
| 7 | - | local maxAmt = 0 |
| 7 | + | |
| 8 | function export(itemID, itemDmg, amt) | |
| 9 | if amt == nil then --if itemDmg isn't specified, amt will be nil and itemDmg will be the proper amt value | |
| 10 | amt = itemDmg --so put itemDmg into amt | |
| 11 | itemDmg = 0 --and use the default value for itemDmg | |
| 12 | - | function export(itemID, amt) |
| 12 | + | |
| 13 | - | local amt = amt |
| 13 | + | |
| 14 | if item.fingerprint.id == itemID and item.fingerprint.dmg == itemDmg then | |
| 15 | - | if item.fingerprint.id == itemID then |
| 15 | + | while amt > 64 do |
| 16 | - | if amt > 64 then |
| 16 | + | |
| 17 | - | while amt > 64 do |
| 17 | + | amt = amt - 64 |
| 18 | - | me.exportItem(item.fingerprint, "SOUTH", amt) |
| 18 | + | |
| 19 | - | amt = amt - 64 |
| 19 | + | me.exportItem(item.fingerprint, "SOUTH", amt) |
| 20 | - | end |
| 20 | + | |
| 21 | end | |
| 22 | - | else |
| 22 | + | |
| 23 | ||
| 24 | function exportExcess(itemID, itemDmg, maxAmt) | |
| 25 | if maxAmt == nil then --if itemDmg isn't specified, maxAmt will be nil and itemDmg will be the proper maxAmt value | |
| 26 | maxAmt = itemDmg --so put itemDmg into maxAmt | |
| 27 | itemDmg = 0 --and use the default value for itemDmg | |
| 28 | end | |
| 29 | - | function exportExcess(itemID, maxAmt) |
| 29 | + | |
| 30 | if item.fingerprint.id == itemID and item.fingerprint.dmg == itemDmg then | |
| 31 | if item.size > maxAmt then | |
| 32 | - | if item.fingerprint.id == itemID then |
| 32 | + | |
| 33 | export(itemID, itemDmg, item.size-maxAmt) | |
| 34 | end | |
| 35 | - | export(itemID, item.size-maxAmt) |
| 35 | + | |
| 36 | end | |
| 37 | end | |
| 38 | ||
| 39 | ||
| 40 | -- Main code | |
| 41 | ||
| 42 | while true do | |
| 43 | term.clear() | |
| 44 | term.setCursorPos(1,1) | |
| 45 | list = me.getAvailableItems() | |
| 46 | exportExcess("minecraft:cobblestone", 500000)
| |
| 47 | os.sleep(10) | |
| 48 | end |