Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function left()
- turtle.turnLeft()
- if turtle.detect() then
- --turtle.dig()
- end
- turtle.suck()
- turtle.forward()
- turtle.turnRight()
- end
- local function right()
- turtle.turnRight()
- if turtle.detect() then
- --turtle.dig()
- end
- turtle.suck()
- turtle.forward()
- turtle.turnLeft()
- end
- local function forward()
- if turtle.detect() then
- --turtle.dig()
- end
- turtle.suck()
- turtle.forward()
- end
- local function back()
- turtle.suck()
- turtle.back()
- end
- local function up()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- local function down()
- turtle.down()
- end
- local function empty()
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1, 16 do
- local item= turtle.getItemDetail(i)
- if item and item.name == "minecraft:spruce_log" then
- turtle.select(i)
- turtle.drop(item.amount)
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- local function clear()
- turtle.turnRight()
- for i=1, 16 do
- local item= turtle.getItemDetail(i)
- if i > 1 and item and (item.name == "minecraft:spruce_sapling" or item.name == "twigs:twig") then
- turtle.select(i)
- turtle.drop(item.amount)
- end
- end
- turtle.turnLeft()
- end
- local function goRefuel()
- left()
- forward()
- up()
- left()
- turtle.suckDown(10)
- right()
- down()
- back()
- right()
- end
- local function breakTree()
- local count = -1
- turtle.down()
- while ( turtle.detect() ) do
- turtle.dig()
- if (turtle.detectUp()) then
- turtle.digUp()
- end
- turtle.up()
- count = count + 1
- end
- for i=count, 0, -1 do
- turtle.down()
- end
- end
- local function plantTree()
- if not turtle.detect() and turtle.getItemDetail(1) and turtle.getItemDetail(1).name == "minecraft:spruce_sapling" then
- turtle.select(1)
- turtle.place(1)
- end
- end
- local function collectItems()
- for i=1, 3 do
- turtle.forward()
- turtle.suck()
- turtle.turnLeft()
- turtle.forward()
- turtle.suck()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.suck()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- for i=1, 3 do
- turtle.back()
- end
- end
- local function refuel()
- for i=1, 16 do
- local item = turtle.getItemDetail(i)
- if item and item.name == "minecraft:charcoal" then
- turtle.select(i)
- turtle.refuel()
- end
- end
- end
- local x = 1
- local y = 1
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.write(x .. " , " .. y)
- term.setCursorPos(1,2)
- term.write(turtle.getFuelLevel())
- turtle.select(1)
- if x == 6 and y == 6 then
- left()
- for i=1 , 10 do
- back()
- end
- right()
- empty()
- clear()
- goRefuel()
- refuel()
- sleep(300)
- x = 1
- y = 1
- elseif y == 2 or y == 4 or y == 6 then
- if x ~= 6 then
- left()
- left()
- x = x + 1
- else
- left()
- forward()
- forward()
- right()
- x = 1
- y = y + 1
- end
- else
- if x ~= 6 then
- right()
- right()
- x = x + 1
- else
- right()
- forward()
- forward()
- left()
- x = 1
- y = y + 1
- end
- end
- plantTree()
- up()
- if turtle.detect() then
- down()
- if x == 1 and y == 1 then
- else
- breakTree()
- end
- plantTree()
- else
- down()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment