Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inv = peripheral.wrap("right")
- height = 1
- saplings = 1
- bonemeal = 2
- local tArgs = {...}
- turtle.select(1)
- local function getSaplings()
- turtle.turnLeft()
- inv.suckSneaky(0,64-turtle.getItemCount(saplings))
- turtle.turnRight()
- end
- local function getBonemeal()
- turtle.turnRight()
- turtle.select(bonemeal)
- inv.suckSneaky(0,64-turtle.getItemCount(bonemeal))
- turtle.turnLeft()
- end
- local function plant()
- turtle.place()
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- end
- if tArgs[1] == nil then
- tArgs[1] = 1
- end
- for t = 1,tonumber(tArgs[1]) do
- times = 0
- if turtle.getItemCount(saplings) < 64 then
- getSaplings()
- end
- if turtle.getItemCount(bonemeal) < 64 then
- getBonemeal()
- else
- print("I don't need bonemeal")
- end
- while times ~= 64 and turtle.getItemCount(saplings) > 0 and turtle.getItemCount(bonemeal) > 0 and turtle.getFuelLevel() > 800 do
- for i = 1,4 do
- turtle.forward()
- end
- plant()
- turtle.dig()
- turtle.forward()
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- height = height+1
- end
- for i = 1,height do
- turtle.down()
- end
- turtle.back()
- sleep(10)
- plant()
- times = times+1
- print(times)
- end
- for i = 1,4 do
- turtle.back()
- end
- for i = 1,8 do
- turtle.select(i)
- if turtle.compareTo(16) then
- turtle.dropDown()
- else
- print("Not wood!")
- if turtle.compareTo(14) then
- print("It's saplings!")
- turtle.transferTo(1)
- elseif turtle.compareTo(15) then
- print("It's bonemeal!")
- turtle.transferTo(2)
- end
- end
- end
- turtle.select(1)
- print("Done with rotation:"..t)
- end
Advertisement
Add Comment
Please, Sign In to add comment