Advertisement
NicoVIII

Charcoal Farm

Jul 1st, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local saplingSlot = 1
  2.  
  3. function forward()
  4.   while not turtle.forward() do
  5.     turtle.dig()
  6.     turtle.attack()
  7.   end
  8. end
  9.  
  10.  
  11. function back()
  12.   while not turtle.back() do
  13.     turtle.turnLeft()
  14.     turtle.turnLeft()
  15.     turtle.dig()
  16.     turtle.turnLeft()
  17.     turtle.turnLeft()
  18.   end
  19. end
  20.  
  21. function plant()
  22.   turtle.select(saplingSlot)
  23.   forward()
  24.   turtle.dig()
  25.   turtle.place()
  26.   back()
  27.   turtle.place()
  28.   turtle.turnRight()
  29.   forward()
  30.   turtle.turnLeft()
  31.   forward()
  32.   turtle.dig()
  33.   turtle.place()
  34.   back()
  35.   turtle.place()
  36.   turtle.turnLeft()
  37.   forward()
  38.   turtle.turnRight()
  39.   while turtle.compare() do
  40.     sleep(5)
  41.   end
  42. end
  43.  
  44. function chop()
  45.   turtle.dig()
  46.   forward()
  47.   local height= 0
  48.   while turtle.digUp() do
  49.     turtle.dig()
  50.     turtle.up()
  51.     height=height+1
  52.   end
  53.   turtle.turnRight()
  54.   turtle.dig()
  55.   forward()
  56.   turtle.turnLeft()
  57.   for i=height, 1,-1 do
  58.     turtle.digDown()
  59.     turtle.dig()
  60.     turtle.down()
  61.   end
  62.   turtle.dig()
  63.   turtle.turnLeft()
  64.   forward()
  65.   turtle.turnRight()
  66.   back()
  67. end
  68.  
  69. function unload()
  70.   for slot=1,16 do
  71.     if slot ~= saplingSlot then
  72.       turtle.select(slot)
  73.       turtle.dropDown()
  74.     end
  75.   end
  76. end
  77.  
  78. while true do
  79.   plant()
  80.   chop()
  81.   unload()
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement