Advertisement
ronaldo1e

treeFilter

Dec 13th, 2020 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. os.loadAPI("functions")
  2. os.loadAPI("typeGen")
  3.  
  4. local SLOT_COUNT = 16
  5.  
  6. STICKS = {"minecraft:stick"}
  7.  
  8. orientation = 0
  9. directions = {
  10.    
  11. }
  12.  
  13. function turnTo(to, from)
  14.     if to == from then
  15.         return to
  16.     elseif to < from then
  17.         turtle.turnLeft()
  18.         return turnTo(to, from-1)
  19.     else
  20.         turtle.turnRight()
  21.         return turnTo(to, from+1)
  22.     end
  23. end
  24.  
  25.  
  26. while true do
  27.     for i = 1, SLOT_COUNT, 1 do
  28.         data = turtle.getItemDetail(i)
  29.         if data then
  30.             turtle.select(i)
  31.             if functions.inTable(typeGen.SAPLINGS, data.name) then
  32.                 orientation = turnTo(0, orientation)
  33.                 if not turtle.drop() then
  34.                     orientation = turtle.turnTo(-1, orientation)
  35.                     turtle.drop()
  36.                 end
  37.             elseif functions.inTable(typeGen.ALL_LOGS, data.name) then
  38.                 turtle.dropDown()
  39.             else
  40.                 orientation = turnTo(-1, orientation)
  41.                 turtle.drop()
  42.             end
  43.         end
  44.     end
  45.     turtle.select(1)
  46.  
  47.     while not redstone.getInput("top") do
  48.         sleep(4)
  49.     end
  50. end
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement