SHARE
TWEET

Untitled

a guest Feb 20th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Inventory = Array 1 - 16
  2. -- Slot: 13 - What to axe
  3. -- Slot: 14 - Fuel
  4. -- Slot: 15 - Torch
  5. -- Slot: 16 - Sappling
  6.  
  7. function moveForward()
  8.     i = 1
  9.     while i <= 5 do
  10.         turtle.forward()
  11.         i = i + 1
  12.     end
  13. end
  14.  
  15. function woodAbove()
  16.     if turtle.compareTo(13) then
  17.         turtle.dig()
  18.         turtle.up()
  19.         return true
  20.     else
  21.         return false
  22.     end
  23. end
  24.  
  25. function plantTree()
  26.     turtle.turnLeft()
  27.     turtle.forward()
  28.     local height = 0
  29.     if turtle.detect() then
  30.         if turtle.compareTo(13) then
  31.             turtle.dig()
  32.             turtle.forward()
  33.             while woodAbove() do
  34.                 height = height + 1
  35.                 woodAbove()
  36.             end
  37.             while height > 0 do
  38.                 turtle.down()
  39.                 height = height - 1
  40.             end
  41.             turtle.back()
  42.             turtle.back()
  43.         else
  44.             turtle.back()
  45.         end
  46.     else
  47.         turtle.select(16)
  48.         turtle.place()
  49.         turtle.back()
  50.     end
  51. end
  52.  
  53.  
  54. local numberOfTrees = 2
  55.  
  56. while numberOfTrees > 0 do
  57.     moveForward()
  58.     plantTree()
  59.     turtle.turnLeft()
  60.     plantTree()
  61. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top