Orion09

wheat

Mar 24th, 2026 (edited)
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. -- wheat_hunter.lua
  2. -- Spins in place scanning for fully grown wheat.
  3. -- Steps forward to harvest if found in front, digs directly for up/down.
  4.  
  5. local function isFullyGrown(inspectFn)
  6. local ok, data = inspectFn()
  7. return ok and data.name == "minecraft:wheat" and data.state and data.state.age == 7
  8. end
  9.  
  10. print("Wheat hunter running. Ctrl+T to stop.")
  11.  
  12. while true do
  13. for _ = 1, 4 do
  14. if isFullyGrown(turtle.inspectDown) then
  15. turtle.digDown()
  16. end
  17. if isFullyGrown(turtle.inspectUp) then
  18. turtle.digUp()
  19. end
  20. if isFullyGrown(turtle.inspect) then
  21. turtle.forward()
  22. turtle.dig()
  23. turtle.back()
  24. end
  25. turtle.turnRight()
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment