Advertisement
PancakePhD

Battery Machine Block

Feb 4th, 2023 (edited)
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chestFull = false
  2.  
  3. function fillSlots(start, finish)
  4.     for i=start,finish do
  5.         turtle.select(i)
  6.         while turtle.getItemCount() < 64 do
  7.             turtle.suckUp(64-turtle.getItemCount())
  8.         end
  9.     end
  10. end
  11.  
  12. function emptyInventory()
  13.     for i=1,16 do
  14.         turtle.select(i)
  15.         item = turtle.getItemDetail()
  16.         if item and item.name == "ic2:blockmachinelv" then
  17.             dropped, message = turtle.dropDown()
  18.  
  19.             if not dropped then
  20.                 chestFull = true
  21.                 return
  22.             else
  23.                 chestFull = false
  24.             end
  25.         end
  26.     end
  27. end
  28.  
  29. function craftMachineBlock()
  30.     fillSlots(1, 3)
  31.     fillSlots(5, 5)
  32.     fillSlots(7, 7)
  33.     fillSlots(9, 11)    
  34.  
  35.     turtle.craft()
  36. end
  37.  
  38. while true do
  39.     while redstone.getInput("back") and not chestFull do
  40.         emptyInventory()
  41.         if not chestFull then
  42.             craftMachineBlock()
  43.         end
  44.     end
  45.     sleep(1)
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement