Advertisement
Doug4347

hopperFeeder.lua

Dec 5th, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chest = peripheral.wrap("diamond_4")
  2. hopper = peripheral.wrap("hopper_0")
  3. direction = "EAST"
  4.  
  5. stackID = 1
  6.  
  7. chestMax = chest.getInventorySize()
  8.  
  9. stack = chest.getStackInSlot(1)
  10. while stack == nil do
  11.     stack = chest.getStackInSlot(1)
  12.     sleep(0.1)
  13. end
  14.  
  15. while true do
  16.     stack = chest.getStackInSlot(stackID)
  17.     hopperStack = hopper.getStackInSlot(1)
  18.     if stack ~= nil and hopperStack == nil then
  19.         stackTable = chest.getStackInSlot(stackID)
  20.         chest.pushItemIntoSlot(direction, stackID, stackTable[qty])
  21.         stackID = stackID + 1
  22.         if stackID > chestMax then
  23.             stackID = 1
  24.         end
  25.     elseif stack == nil and hopperStack == nil then
  26.         stackID = 1
  27.     end
  28.     sleep(0.1)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement