Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- wheat_hunter.lua
- -- Spins in place scanning for fully grown wheat.
- -- Steps forward to harvest if found in front, digs directly for up/down.
- local function isFullyGrown(inspectFn)
- local ok, data = inspectFn()
- return ok and data.name == "minecraft:wheat" and data.state and data.state.age == 7
- end
- print("Wheat hunter running. Ctrl+T to stop.")
- while true do
- for _ = 1, 4 do
- if isFullyGrown(turtle.inspectDown) then
- turtle.digDown()
- end
- if isFullyGrown(turtle.inspectUp) then
- turtle.digUp()
- end
- if isFullyGrown(turtle.inspect) then
- turtle.forward()
- turtle.dig()
- turtle.back()
- end
- turtle.turnRight()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment