Advertisement
RDS_YES

autoandestitesystem

Nov 15th, 2022 (edited)
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. local modem = peripheral.find("modem") or error("No modem attached", 0)
  2. rednet.open(peripheral.getName(modem))
  3. local trtid = 57
  4. local quartzin = peripheral.wrap("minecraft:chest_17")
  5. local quartzout = peripheral.wrap("minecraft:chest_15")
  6. local nugin = peripheral.wrap("minecraft:chest_19")
  7. local nugout = peripheral.wrap("minecraft:chest_18")
  8. local resultsin = peripheral.wrap("minecraft:chest_20")
  9. local resultsout = peripheral.wrap("minecraft:chest_21")
  10. while true do
  11. local input = read()
  12. input = tonumber(input)
  13. if input < 4 then
  14. input = 4
  15. elseif input > (64 * 9) then
  16. input = 64 * 9
  17. end
  18. if input % 4 ~= 0 then
  19. input = math.floor(input / 4 + 1) * 4
  20. end
  21. rednet.send(trtid,input)
  22. local quartz = input / 2
  23. rednet.receive()
  24. for i = 1,nugin.size() do
  25. nugout.pullItems(peripheral.getName(nugin),i)
  26. end
  27. while true do
  28. for i = 1,quartzin.size() do
  29. if quartz == 0 then break end
  30. local quartztemp = quartz
  31. local item = quartzin.getItemDetail(i)
  32. if quartztemp > 64 then quartztemp = 64 end
  33. if item then
  34. if quartztemp >= item.count then
  35. quartz = quartz - item.count
  36. elseif quartztemp < item.count then
  37. quartz = quartz - quartztemp
  38. end
  39. quartzout.pullItems(peripheral.getName(quartzin),i,quartztemp)
  40. end
  41. end
  42. if quartz == 0 then break end
  43. end
  44. while true do
  45. for i = 1,resultsin.size() do
  46. if input == 0 then break end
  47. local inputtemp = input
  48. local item = resultsin.getItemDetail(i)
  49. if inputtemp > 64 then inputtemp = 64 end
  50. if item then
  51. if inputtemp >= item.count then
  52. input = input - item.count
  53. elseif inputtemp < item.count then
  54. input = input - inputtemp
  55. end
  56. resultsout.pullItems(peripheral.getName(resultsin),i,inputtemp)
  57. end
  58. end
  59. if input == 0 then break end
  60. end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement