Advertisement
thatTopHatCat

warehouseGet

May 15th, 2022 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. args={...}
  2. output=peripheral.wrap("minecraft:barrel_0")
  3.  
  4. if string.match(args[1],":") then
  5.    item=args[1]
  6. else
  7.     item="minecraft:"..args[1]
  8. end
  9. for invnameindex,invname in pairs(peripheral.getNames()) do
  10.     local inv=peripheral.wrap(invname)
  11.     local t1,t2,t3=peripheral.getType(invname)
  12.     if (t1=="inventory" or t2=="inventory" or t3=="inventory")and not(invname==peripheral.getName(output)) then
  13.         local items=inv.list()
  14.         for k,v in pairs(items) do
  15.             if  v.name==item then
  16.                 inv.pushItems(peripheral.getName(output),k)
  17.                 print("i found "..v.count)
  18.             end
  19.         end
  20.     end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement