Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- treeSpacing=2
- deepCount=9
- wideCount=14
- minFuel=30
- fuelSpot=1
- woodSpot=2
- saplingSpot=3
- fertilizerSpot=4
- sapBackup=16
- function plantTree()
- turtle.select(saplingSpot)
- turtle.placeDown()
- if turtle.getItemCount(saplingSpot)==0 then
- turtle.select(sapBackup)
- turtle.transferTo(saplingSpot,turtle.getItemCount(sapBackup))
- end
- turtle.select(woodSpot)
- end
- function checkFuel()
- if turtle.getFuelLevel() < minFuel then
- turtle.select(fuelSpot)
- turtle.refuel(1)
- end
- end
- function chopTree()
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- plantTree()
- while turtle.compareUp() do
- turtle.digUp()
- turtle.up()
- end
- while turtle.down() do end
- turtle.forward()
- end
- function fertilizeTree()
- turtle.down()
- turtle.select(fertilizerSpot)
- turtle.place()
- turtle.select(woodSpot)
- turtle.up()
- end
- function nextColumn(currentColumn)
- if currentColumn % 2 == 1 then
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- function dumpExtra()
- for slot=5,15 do
- turtle.select(slot)
- turtle.drop()
- end
- end
- function dumpLogs()
- dumpExtra()
- turtle.select(woodSpot)
- turtle.drop(turtle.getItemCount(woodSpot)-1)
- end
- function resetToStart()
- turtle.select(fuelSpot)
- turtle.refuel(2)
- turtle.turnRight()
- while turtle.forward() do end
- turtle.select(saplingSpot)
- turtle.suck()
- turtle.select(sapBackup)
- turtle.suck()
- dumpExtra()
- turtle.turnLeft()
- turtle.select(fuelSpot)
- turtle.suck()
- dumpExtra()
- turnAround()
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function tryChop()
- if turtle.compare() then
- chopTree()
- else
- fertilizeTree()
- if turtle.compare() then
- chopTree()
- else -- if fertilize didn't spawn a tree for some reason, skip this and go to next tree
- turtle.forward()
- turtle.forward()
- end
- end
- end
- --while true do
- checkFuel()
- turtle.up()
- for j=1,wideCount do
- tryChop()
- for i=1,deepCount-1 do
- checkFuel()
- turtle.select(woodSpot)
- for s=1,treeSpacing-1 do
- turtle.forward()
- end
- tryChop()
- end
- if wideCount~=j then
- nextColumn(j)
- end
- end
- turtle.down()
- dumpLogs()
- resetToStart()
- --end
Advertisement
Add Comment
Please, Sign In to add comment