Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Epic tree farm")
- function tree()
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- end
- while true do
- local success, data = turtle.inspectDown()
- if success then
- if data.name == "minecraft:dirt" then
- break
- else
- turtle.digDown()
- turtle.down()
- end
- else
- turtle.digDown()
- turtle.down()
- end
- end
- turtle.up()
- end
- function plant()
- for i=1,16,1 do
- turtle.select(i)
- local data = turtle.getItemDetail(i)
- if data then
- if data.name == "plants2:sapling_0" then
- turtle.placeDown()
- break
- end
- end
- end
- end
- function round()
- while true do
- local success, data = turtle.inspect()
- if success then
- if data.name == "plants2:log_0" then
- tree()
- elseif data.name == "minecraft:stone" then
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- elseif data.name == "minecraft:stonebrick" then
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- return
- else
- print("Unrecognised block: ", data.name)
- end
- end
- plant()
- turtle.forward()
- end
- end
- function empty()
- for i=1,16,1 do
- turtle.select(i)
- local data = turtle.getItemDetail(i)
- if data then
- if data.name == "plants2:sapling_0" then
- turtle.turnLeft()
- turtle.drop(64)
- turtle.turnRight()
- elseif data.name == "plants2:log_0" then
- turtle.dropDown(64)
- else
- print("Unrecognised item in the bagging area: ", data.name)
- end
- end
- end
- end
- function fuel()
- while turtle.getFuelLevel() < 1000 do
- print("Need fuel")
- turtle.turnRight()
- turtle.suck(64)
- for i=1,16,1 do
- turtle.select(i)
- turtle.refuel(64)
- end
- turtle.turnLeft()
- end
- end
- function saplings()
- turtle.select(1)
- turtle.turnLeft()
- turtle.suck(64)
- turtle.turnRight()
- end
- fuel()
- saplings()
- round()
- empty()
Advertisement
Add Comment
Please, Sign In to add comment