Advertisement
RDS_YES

autoandestiteturtle

Nov 15th, 2022 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. local modem = peripheral.find("modem") or error("No modem attached", 0)
  2. local nuggetchest = peripheral.wrap("minecraft:chest_1")
  3. local trt = "turtle_6"
  4. local systemid = 58
  5. rednet.open(peripheral.getName(modem))
  6. turtle.select(1)
  7. while true do
  8. local id, nugs = rednet.receive()
  9. nugs = tonumber(nugs)
  10. local ingots = math.ceil(nugs / 9)
  11. print(nugs,ingots)
  12. local ingottemp = ingots
  13. while true do
  14. turtle.suckUp(ingottemp)
  15. local item = turtle.getItemDetail(1)
  16. if item then
  17. if item.count ~= ingots then
  18. ingottemp = ingots - item.count
  19. elseif item.count == ingots then
  20. break
  21. end
  22. end
  23. end
  24. turtle.craft()
  25. for i = 1,16 do
  26. if nugs == 0 then break end
  27. local nugstemp = nugs
  28. turtle.select(i)
  29. local item = turtle.getItemDetail(i)
  30. if nugstemp > 64 then nugstemp = 64 end
  31. if item then
  32. if nugstemp >= item.count then
  33. nugs = nugs - item.count
  34. elseif nugstemp < item.count then
  35. nugs = nugs - nugstemp
  36. end
  37. turtle.dropDown(nugstemp)
  38. end
  39. end
  40. for i = 1,16 do
  41. local item = turtle.getItemDetail(i)
  42. if item then
  43. nuggetchest.pullItems(trt,i)
  44. end
  45. end
  46. turtle.select(1)
  47. rednet.send(systemid,"done")
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement