Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getChops()
- local sucked
- write("Collecting items")
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.turnLeft()
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.turnLeft()
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.turnLeft()
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.turnLeft()
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.forward(1)
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- write("No more items, moving on.")
- turtle.turnLeft()
- turtle.forward(1)
- turtle.turnRight()
- end
- function placeBehind()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place(1)
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function avoidSapling()
- turtle.turnLeft()
- turtle.forward(1)
- turtle.turnRight()
- turtle.forward(1)
- turtle.forward(1)
- turtle.turnRight()
- turtle.forward(1)
- turtle.turnLeft()
- end
- function hasSapling()
- local item
- local gotSapling
- gotSapling = false
- if turtle.getItemCount(1) > 0 then
- item = turtle.getItemDetail(1)
- if item.name == "minecraft:sapling" then
- gotSapling = true
- end
- end
- return gotSapling
- end
- function placeInChest()
- for i = 2,16 do
- turtle.select(1)
- if turtle.getItemCount(i) > 0 then
- if turtle.compare(i) then
- write("Transferring saplings to active slot")
- turtle.transferTo(i)
- else
- write("Dropping off items")
- turtle.select(i)
- turtle.drop()
- turtle.select(i)
- end
- end
- end
- end
- function getTheFuel()
- local needFuel
- needFuel = True
- for i = 2,16 do
- turtle.select(1)
- if turtle.getItemCount(i) > 0 and needFuel then
- item = turtle.getItemDetail(i)
- write("Found ")
- write(item.name)
- if item.name == "minecraft:log" then
- write("Logs found, refueling")
- turtle.select(i)
- turtle.refuel()
- turtle.select(i)
- needFuel = False
- end
- end
- end
- end
- local infront
- local block
- local h
- local v
- local plant
- local sucked
- h = 1
- v = 1
- f = "right"
- if turtle.getFuelLevel() < 100 then
- write("low on fuel, refueling")
- getTheFuel()
- end
- while hasSapling() and turtle.getFuelLevel() > 10 do
- if turtle.getFuelLevel() < 100 then
- write("low on fuel, refueling")
- getTheFuel()
- end
- turtle.select(1)
- while h <= 16 and hasSapling() do
- while v <= 24 and hasSapling() do
- infront, block = turtle.inspect()
- if infront then
- if block.name == "minecraft:sapling" then
- write("Avoiding Sapling")
- avoidSapling()
- v = v + 2
- else
- if block.name == "minecraft:log" then
- write("Chopping Tree")
- turtle.dig()
- turtle.forward(1)
- getChops()
- v = v + 2
- placeBehind()
- else
- write("Weed in way. Killing.")
- turtle.dig()
- turtle.forward(1)
- v = v + 1
- end
- end
- else
- write("No tree, moving forward")
- turtle.forward(1)
- v = v + 1
- write("Checking for items")
- sucked = turtle.suck()
- while sucked do
- write("Collecting items")
- sucked = turtle.suck()
- end
- end
- end
- if f == "right" then
- write("End of Row, proceeding to next row.")
- turtle.turnRight()
- turtle.forward(1)
- h = h + 1
- turtle.turnRight()
- f = "left"
- v = 1
- else
- write("End of Row, proceeding to next row.")
- turtle.turnLeft()
- turtle.forward(1)
- h = h + 1
- turtle.turnLeft()
- f = "right"
- v = 1
- end
- end
- write("End of Cycle, going back to start.")
- turtle.turnLeft()
- write(h)
- while h > 1 do
- turtle.forward(1)
- h = h - 1
- write("Moving back")
- write(h)
- end
- placeInChest()
- turtle.turnRight()
- end
- write("No more saplings. Stopping auto chopping")
Add Comment
Please, Sign In to add comment