DustyHands

choptree

Mar 29th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. local blockExists, blockLog = turtle.inspect()
  2. local step=0
  3. local function doStep()
  4.   step = step + 1
  5. end
  6.  
  7. while step <= 3 and not turtle.detect() do
  8.   turtle.forward()
  9.   doStep()
  10.   if step == 3 then
  11.     error('Could not find tree!')
  12.   end
  13. end
  14. if blockExists and blockLog["name"] == "minecraft:log" then
  15.   turtle.dig()
  16.   turtle.forward()
  17.   while turtle.detectUp() do
  18.     turtle.digUp()
  19.     turtle.up()
  20.   end
  21.   while not turtle.detectDown() do
  22.     turtle.down()
  23.   end
  24. end
  25. turtle.back()
  26. textutils.slowPrint('Tree chopped')
Advertisement
Add Comment
Please, Sign In to add comment