Advertisement
PancakePhD

Panel Crafter

Feb 4th, 2023
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chestFull = false
  2.  
  3. function fillSlot(slot)
  4.     turtle.select(slot)
  5.     while turtle.getItemCount() < 64 do
  6.         turtle.suck(64-turtle.getItemCount())
  7.     end
  8. end
  9.  
  10. function fillSlotFromUp(slot)
  11.     turtle.select(slot)
  12.     while turtle.getItemCount() < 64 do
  13.         turtle.suckUp(64-turtle.getItemCount())
  14.     end
  15. end
  16.  
  17. function emptyInventory()
  18.     for i=1,16 do
  19.         turtle.select(i)
  20.         item = turtle.getItemDetail()
  21.         if item and item.name == "ic2:blockgenerator" then
  22.             dropped, message = turtle.dropDown()
  23.  
  24.             if not dropped then
  25.                 chestFull = true
  26.                 return
  27.             else
  28.                 chestFull = false
  29.             end
  30.         end
  31.     end
  32. end
  33.  
  34. function craftPanel()
  35.     fillSlot(1)
  36.     fillSlot(3)
  37.     fillSlot(6)
  38.    
  39.     turtle.turnLeft()
  40.  
  41.     fillSlot(2)
  42.     fillSlot(5)
  43.     fillSlot(7)
  44.  
  45.     fillSlotFromUp(9)
  46.     fillSlotFromUp(11)
  47.  
  48.     turtle.turnLeft()
  49.     turtle.turnLeft()
  50.  
  51.     fillSlot(10)
  52.  
  53.     turtle.craft()
  54.  
  55.     turtle.turnLeft()
  56.  
  57.     emptyInventory()
  58. end
  59.  
  60. while true do
  61.     while not chestFull do
  62.         emptyInventory()
  63.         if not chestFull then
  64.             craftPanel()
  65.         end
  66.     end
  67.     sleep(1)
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement