Advertisement
Klazam33

Block Crafter

May 8th, 2021
1,266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. os.loadAPI("kapi")
  2.  
  3. -- Chest to pull from in front, chest to deposit in to the left, and redstone signal on from the back.
  4.  
  5. while true do
  6.  
  7.     if rs.getAnalogInput(back) > 0 then
  8.         print("Signal detected. Picking up materials for block")
  9.         turtle.select(1)
  10.         turtle.suck(64)
  11.         turtle.select(2)
  12.         turtle.suck(64)
  13.         turtle.select(3)
  14.         turtle.suck(64)
  15.         turtle.select(5)
  16.         turtle.suck(64)
  17.         turtle.select(6)
  18.         turtle.suck(64)
  19.         turtle.select(7)
  20.         turtle.suck(64)
  21.         turtle.select(9)
  22.         turtle.suck(64)
  23.         turtle.select(10)
  24.         turtle.suck(64)
  25.         turtle.select(11)
  26.         turtle.suck(64)
  27.  
  28.         if turtle.getItemCount(11) == 64 then
  29.             print("Crafting")
  30.             turtle.select(16)
  31.             turtle.craft(64)
  32.             print("Depositing")
  33.             turtle.turnLeft()
  34.             turtle.drop(64)
  35.             turtle.turnRight()
  36.         else
  37.             print("We seem to be out of materials. \nPress enter to resume.\nEnsure the Turtle is clear of all materials.")
  38.             x = kapi.keyread()
  39.             if x == keys.enter then
  40.                 print("Resuming")
  41.             else
  42.                 print("You didn't hit enter. I'm so disappointed in you. Still resuming though.")
  43.             end
  44.         end
  45.     else
  46.         print("Signal not detected. Powering down, rechecking in one minute.")
  47.         sleep(60)
  48.     end
  49. end
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement