Advertisement
Guest User

treefarm.lua

a guest
Mar 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. saplingSlot = 1
  2. bonemealSlot = 2
  3.  
  4. function chopTree()
  5.     turtle.dig()
  6.     turtle.forward()
  7.    
  8.     while turtle.digUp() do turtle.up() end
  9.    
  10.     while turtle.down() do end
  11.    
  12.     turtle.back()
  13. end
  14.  
  15. function fillChest()
  16.     turtle.turnLeft()
  17.     turtle.turnLeft()
  18.     turtle.select(3)
  19.     turtle.drop()
  20.     turtle.turnLeft()
  21.     turtle.turnLeft()
  22. end
  23.  
  24. function detectTree()
  25.     _, block = turtle.inspect()
  26.     return block['name'] == "minecraft:log"
  27. end
  28.  
  29. function makeTree()
  30.     repeat
  31.         turtle.select(saplingSlot)
  32.         turtle.place()
  33.         turtle.select(bonemealSlot)
  34.         turtle.place()
  35.     until detectTree()
  36. end
  37.  
  38. while true do
  39.     makeTree()            
  40.     chopTree()
  41.     fillChest()
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement