Dimencia

Anothertestfarm

Mar 22nd, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. local fuelSlot = 1
  2. local seedSlot = 2
  3. -- Wheat has all other slots? Or just 3, idk
  4. local wheatSlot = 3
  5. local testSlot = 4
  6. local inferiumSlot = 5
  7.  
  8. -- Note, a working version is at pastebin.com/XwrptbCf
  9.  
  10. turtle.refuel()
  11. while(true) do
  12. -- Check if there's a chest in front of it, to refuel or offload wheat
  13. success,data = turtle.inspect()
  14. if success then
  15. print("Looking for chest, name: ", data.name)
  16. for k,v in pairs(data.state) do
  17. print("data.state." .. k, v)
  18. end
  19. for k,v in pairs(data.tags) do
  20. print("data.tags." .. k,v)
  21. end
  22. if data.tags["forge:chests"] then -- quark:birchchest is mine... has to be a better way...
  23. -- Pick up whatever's in it into slot 4
  24. turtle.select(testSlot)
  25. turtle.suck()
  26. -- See what we picked up
  27. local slotdata = turtle.getItemDetail()
  28. if slotdata ~= nil then
  29. print("Slot name: ", slotdata.name)
  30. if slotdata.name == "minecraft:wheat" then
  31. -- Put it back, and put any wheat we have in there
  32. turtle.drop()
  33. turtle.select(wheatSlot)
  34. turtle.drop()
  35. elseif slotdata.name == "minecraft:coal" then
  36. if not turtle.transferTo(fuelSlot) then
  37. turtle.drop() -- Put any leftovers back
  38. end
  39. end
  40. else
  41. -- If there was nothing in the chest, put wheat and inferium in
  42. turtle.select(wheatSlot)
  43. turtle.drop()
  44. turtle.select(inferiumSlot)
  45. turtle.drop()
  46. end
  47. end
  48. end
  49. turtle.turnRight()
  50. -- Inspect the block in front of it
  51. local success, data = turtle.inspect()
  52. if success then
  53. -- data contains fields: name, tags, state
  54. print("Name: ", data.name)
  55. -- inferium_crop
  56. if data.name == "minecraft:wheat" or data.name == "mysticalagriculture:inferium_crop" then
  57. --if data.state.age == 7 then
  58. turtle.select(seedSlot)
  59. turtle.place()
  60. turtle.select(wheatSlot)
  61. turtle.suck()
  62. turtle.select(inferiumSlot)
  63. turtle.suck()
  64. turtle.select(seedSlot)
  65. turtle.suck()
  66. --end
  67. end
  68. turtle.turnLeft() -- Turn back forward
  69. end -- If there's nothing in front of it, it can just keep going that way.
  70. if not turtle.forward() then -- Do a 180
  71. turtle.turnLeft()
  72. turtle.turnLeft()
  73. end
  74.  
  75.  
  76. -- After everything, check all slots... if wheat is found, try to move to wheatslot
  77. -- etc
  78.  
  79. end
  80.  
  81. -- For wheat, an age of 7 is what we want. Name is "minecraft:wheat"
  82. -- We get that from data.state.age
  83.  
  84.  
  85.  
Add Comment
Please, Sign In to add comment