Advertisement
colhaydutu

Untitled

Nov 2nd, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. modem.open(1)
  3.  
  4. local source = peripheral.getNames()
  5.  
  6. while true do
  7. local sourceChests = {}
  8. local targetChests = {}
  9.  
  10. for _, name in ipairs(source) do
  11. if string.match(name, "minecraft:chest") then
  12. table.insert(sourceChests, peripheral.wrap(name))
  13. elseif string.match(name, "techreborn:recycler") then
  14. table.insert(targetChests, peripheral.wrap(name))
  15. end
  16. end
  17.  
  18. for _, sourceChest in ipairs(sourceChests) do
  19. for _, targetChest in ipairs(targetChests) do
  20. local targetName = peripheral.getName(targetChest)
  21. for slot, item in pairs(sourceChest.list()) do
  22. sourceChest.pushItems(targetName, slot, item.count, 1)
  23. end
  24. end
  25. end
  26.  
  27. sleep(1)
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement