Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to cut crop and plant seed
- function cutAndPlant()
- turtle.digDown()
- turtle.placeDown()
- end
- -- Function to move forward 25 blocks
- function moveForward25()
- for i = 1, 25 do
- cutAndPlant()
- if i < 25 then
- turtle.forward()
- end
- end
- end
- -- Function to move to the next row
- function moveToNextRow(row)
- if row % 2 == 1 then
- -- Odd row: turn right, move forward, turn right
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- else
- -- Even row: turn left, move forward, turn left
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- -- Function to farm the field
- function farmField()
- for row = 1, 18 do
- moveForward25()
- if row < 18 then
- moveToNextRow(row)
- end
- end
- end
- -- Function to return to starting position
- function returnToStart()
- -- Return to the starting row
- turtle.turnRight()
- for i = 1, 17 do
- turtle.forward()
- end
- turtle.turnRight()
- -- Return to the starting column
- for i = 1, 25 do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight() -- Face the original direction
- end
- -- Main loop to continuously farm the field
- while true do
- farmField()
- returnToStart()
- -- Sleep for a specified time before starting over (e.g., 10 minutes)
- os.sleep(600)
- end
Add Comment
Please, Sign In to add comment