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)
- rednet.open(peripheral.getName(modem))
- local trtid = 57
- local quartzin = peripheral.wrap("minecraft:chest_17")
- local quartzout = peripheral.wrap("minecraft:chest_15")
- local nugin = peripheral.wrap("minecraft:chest_19")
- local nugout = peripheral.wrap("minecraft:chest_18")
- local resultsin = peripheral.wrap("minecraft:chest_20")
- local resultsout = peripheral.wrap("minecraft:chest_21")
- while true do
- local input = read()
- input = tonumber(input)
- if input < 4 then
- input = 4
- elseif input > (64 * 9) then
- input = 64 * 9
- end
- if input % 4 ~= 0 then
- input = math.floor(input / 4 + 1) * 4
- end
- rednet.send(trtid,input)
- local quartz = input / 2
- rednet.receive()
- for i = 1,nugin.size() do
- nugout.pullItems(peripheral.getName(nugin),i)
- end
- while true do
- for i = 1,quartzin.size() do
- if quartz == 0 then break end
- local quartztemp = quartz
- local item = quartzin.getItemDetail(i)
- if quartztemp > 64 then quartztemp = 64 end
- if item then
- if quartztemp >= item.count then
- quartz = quartz - item.count
- elseif quartztemp < item.count then
- quartz = quartz - quartztemp
- end
- quartzout.pullItems(peripheral.getName(quartzin),i,quartztemp)
- end
- end
- if quartz == 0 then break end
- end
- while true do
- for i = 1,resultsin.size() do
- if input == 0 then break end
- local inputtemp = input
- local item = resultsin.getItemDetail(i)
- if inputtemp > 64 then inputtemp = 64 end
- if item then
- if inputtemp >= item.count then
- input = input - item.count
- elseif inputtemp < item.count then
- input = input - inputtemp
- end
- resultsout.pullItems(peripheral.getName(resultsin),i,inputtemp)
- end
- end
- if input == 0 then break end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement