Advertisement
TheZachAttack01

woodcutter r.1

Oct 9th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. --[[
  2.  
  3. auto plants and chops 1x1 trees
  4. place one sapling in slot 14, one bonemeal in slot 15, and one fuel in slot 16
  5. chest on the right for dumping
  6. chest on the left for resupplying
  7.  
  8. --]]
  9.  
  10. running = true
  11. while running do
  12.  turtle.turnRight()
  13.  for i = 1,13,1 do
  14.   turtle.select(i)
  15.   if not turtle.compareTo(14) and not turtle.compareTo(15) and not turtle.compareTo(16) then
  16.    turtle.drop()
  17.   end
  18.  end
  19.  turtle.turnLeft()
  20.  turtle.turnLeft()
  21.  for i = 4,13,1 do
  22.   turtle.select(i)
  23.   if turtle.getItemSpace(i) == 64 then
  24.    turtle.suck()
  25.   end
  26.   if turtle.compareTo(14) then
  27.    turtle.transferTo(1)
  28.   elseif turtle.compareTo(15) then
  29.    turtle.transferTo(2)
  30.   elseif turtle.compareTo(16) then
  31.    turtle.transferTo(3)
  32.   end
  33.  end
  34.  turtle.turnRight()
  35.  if turtle.getItemCount(1) == 0 then
  36.   print("Out of Saplings")
  37.   print("Stopping")
  38.   running = false
  39.  end
  40.  if turtle.getItemCount(2) == 0 then
  41.   print("Out of Bonemeal")
  42.   print("Stopping")
  43.   running = false
  44.  end
  45.  while turtle.getFuelLevel() <= 20 and turtle.getItemCount(3) >= 1 do
  46.   turtle.select(3)
  47.   turtle.refuel(1)
  48.  end
  49.  if turtle.getFuelLevel() <= 20 then
  50.   print("Out of Fuel")
  51.   print("Stopping")
  52.   running = false
  53.  end
  54.  if running then
  55.   turtle.select(1)
  56.   turtle.place()
  57.  
  58.   needsBoneMeal = true
  59.        
  60.         while needsBoneMeal do
  61.             turtle.select(2)
  62.             turtle.place()
  63.             turtle.up()
  64.            
  65.             if turtle.detect() then
  66.                 needsBoneMeal = false
  67.             end
  68.            
  69.             turtle.down()
  70.         end
  71.     while turtle.detect() do
  72.     turtle.dig()
  73.     turtle.digUp()
  74.     turtle.up()
  75.     end
  76.   while not turtle.detectDown() do
  77.    turtle.down()
  78.   end
  79.  end
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement