Advertisement
Lion4ever

vTree

Apr 18th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local tHeight = 8
  2. local number = 22
  3.  
  4. local Height = 0
  5.  
  6. local function sel(item)
  7.   for i=1,16 do
  8.     if turtle.getItemCount(i) > 0 and turtle.getItemDetail(i).name == item then
  9.       turtle.select(i)
  10.       return true
  11.     end
  12.   end
  13.   return false
  14. end
  15.  
  16. function b()
  17.   local a,c = turtle.inspect()
  18.   if a then
  19.     return c.name
  20.   else
  21.     return "minecraft:air"
  22.   end
  23. end
  24.  
  25. local function check()
  26.   if Height % tHeight == 0 then
  27.     if b() ~= "minecraft:dirt" then
  28.       turtle.dig()
  29.       sel("minecraft:dirt")
  30.       turtle.place()
  31.       turtle.select(1)
  32.     end
  33.   elseif Height % tHeight ==1 then
  34.     if b() ~= "minecraft:sapling"  then
  35.       turtle.dig()
  36.       sel("minecraft:sapling")
  37.       turtle.place()
  38.       turtle.select(1)
  39.     end
  40.   else
  41.     turtle.dig()
  42.   end
  43. end
  44. turtle.select(1)
  45. while Height < tHeight * number do
  46.   check()
  47.   repeat
  48.     turtle.digUp()
  49.   until turtle.up()
  50.   Height = Height + 1
  51. end
  52.   check()
  53. while Height > 0 do
  54.   repeat
  55.     turtle.digDown()
  56.   until turtle.down()
  57.   Height = Height - 1
  58.   check()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement