Advertisement
9551

Untitled

Jul 14th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. local b = require("button").monitor
  2. local maxscale = 0
  3. local count = 1
  4. local op = {}
  5. local m = peripheral.find("monitor")
  6. local maxitems = 0
  7. m.clear()
  8. m.setTextScale(0.5)
  9. m.setCursorPos(3, 15)
  10. m.write("counting..")
  11. local pers = peripheral.getNames()
  12. for i = 1, #pers do
  13.     if peripheral.getType(pers[i]) == "minecraft:chest" then
  14.         op[count] = pers[i]
  15.         count = count + 1
  16.     end
  17. end
  18. for i = 1, #op do
  19.     maxitems = maxitems + peripheral.wrap(op[i]).size() * 64
  20. end
  21. local function main()
  22.     while true do
  23.         local curitems = 0
  24.         for i = 1, #op do
  25.             for x = 1, peripheral.wrap(op[i]).size() do
  26.                 local item = peripheral.wrap(op[i]).getItemMeta(x) or {count = 0}
  27.                 curitems = curitems + item.count
  28.             end
  29.         end
  30.         m.setCursorPos(6, 1)
  31.         m.write("silo")
  32.         b.bar("top", 3, 13, 12, 11, curitems, maxitems, "gray", "red", "white", true, true, "", true, true, true)
  33.     end
  34. end
  35. local ok, err = pcall(main)
  36. if not ok then
  37.     m.clear()
  38.     print("program stopped reason:\n" .. err)
  39. end
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement