Advertisement
qwertyqwerty2

Untitled

Jul 4th, 2016
3,079
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Up()
  2.     repeat until turtle.up()
  3. end
  4.  
  5. function Down()
  6.     repeat until turtle.down()
  7. end
  8.  
  9. function Forward()
  10.     repeat until turtle.forward()
  11. end
  12.  
  13. function Back()
  14.     repeat until turtle.back()
  15. end
  16.  
  17. function TR()
  18.     turtle.turnRight()
  19. end
  20.  
  21. function TL()
  22.     turtle.turnLeft()
  23. end
  24.  
  25. function Search(item)
  26.     for i=1,16 do
  27.         local data = turtle.getItemDetail(i)
  28.         if data ~= nil and data.name == item then
  29.             return i
  30.         end
  31.     end
  32.     return false
  33. end
  34.  
  35. function Deposit()
  36.     TL()
  37.     TL()
  38.     for i=1,16 do
  39.         local data = turtle.getItemDetail(i)
  40.         if data ~= nil and data.name == "minecraft:log" then
  41.             turtle.select(i)
  42.             turtle.drop()
  43.         end
  44.     end
  45.     TL()
  46.     TL()
  47. end
  48.  
  49. function GetTrees()
  50.     TL()
  51.     repeat
  52.     turtle.suck(64)
  53.     until Search("minecraft:sapling")
  54.     TR()
  55. end
  56.  
  57. function GetFert()
  58.     TR()
  59.     repeat
  60.     turtle.suck(64)
  61.     until Search("Forestry:fertilizerCompound")
  62.     TL()
  63. end
  64.  
  65. function MainLoop()
  66.     if not Search("minecraft:log") then
  67.         GetTrees()
  68.     end
  69.     turtle.select(Search("minecraft:sapling"))
  70.     turtle.place()
  71.     repeat
  72.         if not Search("Forestry:fertilizerCompound") then
  73.             GetFert()
  74.         end
  75.         turtle.select(Search("Forestry:fertilizerCompound"))
  76.         turtle.place()
  77.     suc, data = turtle.inspect()
  78.     until data.name == "minecraft:log"
  79.     turtle.dig()
  80.     Forward()
  81.     local count = 0
  82.     while turtle.detectUp() do
  83.     turtle.digUp()
  84.     Up()
  85.     count = count + 1
  86.     end
  87.     for i=1, count do
  88.         Down()
  89.     end
  90.     Back()
  91.     if turtle.getItemCount(16) ~= 0 then
  92.         Deposit()
  93.     end
  94. end
  95.  
  96. while true do
  97. MainLoop()
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement