Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem") or error("No modem attached", 0)
- local nuggetchest = peripheral.wrap("minecraft:chest_1")
- local trt = "turtle_6"
- local systemid = 58
- rednet.open(peripheral.getName(modem))
- turtle.select(1)
- while true do
- local id, nugs = rednet.receive()
- nugs = tonumber(nugs)
- local ingots = math.ceil(nugs / 9)
- print(nugs,ingots)
- local ingottemp = ingots
- while true do
- turtle.suckUp(ingottemp)
- local item = turtle.getItemDetail(1)
- if item then
- if item.count ~= ingots then
- ingottemp = ingots - item.count
- elseif item.count == ingots then
- break
- end
- end
- end
- turtle.craft()
- for i = 1,16 do
- if nugs == 0 then break end
- local nugstemp = nugs
- turtle.select(i)
- local item = turtle.getItemDetail(i)
- if nugstemp > 64 then nugstemp = 64 end
- if item then
- if nugstemp >= item.count then
- nugs = nugs - item.count
- elseif nugstemp < item.count then
- nugs = nugs - nugstemp
- end
- turtle.dropDown(nugstemp)
- end
- end
- for i = 1,16 do
- local item = turtle.getItemDetail(i)
- if item then
- nuggetchest.pullItems(trt,i)
- end
- end
- turtle.select(1)
- rednet.send(systemid,"done")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement