Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local length
- local width
- if (args[1] ~= nil) then
- length = tonumber(args[1])
- end
- if (args[2] ~= nil) then
- width = tonumber(args[2])
- end
- function atGround()
- local success,data = turtle.inspectDown()
- if (data ~= nil and (data.name == "minecraft:grass" or data.name == "minecraft:dirt")) then
- return true
- else
- return false
- end
- end
- function placeWheat()
- while (not atGround()) do
- if (not turtle.down()) then
- if (not turtle.digDown()) then
- print("Unable to go down. Please ensure there is dirt under the turtle. Then press enter.")
- read()
- end
- end
- end
- while (not turt.select("minecraft:wheat_seeds")) do
- print("Add more seeds and press enter.")
- read()
- end
- turtle.up()
- turtle.digDown()
- turtle.placeDown()
- end
- function moveForward()
- while (turtle.detect()) do
- while (not turtle.up()) do
- print("Vertical obstruction. Remove and press enter.")
- read()
- end
- end
- while (not turtle.forward()) do
- print("Obstruction. Trying again.")
- end
- end
- function row()
- for i=1,length do
- placeWheat()
- moveForward()
- end
- end
- function main()
- for i=1,width do
- row()
- if (i % 2 == 0) then
- turtle.turnLeft()
- moveForward()
- turtle.turnLeft()
- else
- turtle.turnRight()
- moveForward()
- turtle.turnRight()
- end
- moveForward()
- end
- end
- if (not fs.exists("turt")) then
- print("Installing Turt API.")
- shell.run("pastebin get 7jXkEZX6 turt")
- end
- os.loadAPI("turt")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement