Advertisement
Mine_Crafter

ItemCounter ComputerCraft

Apr 30th, 2022
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. mon = peripheral.find("monitor")
  2.  
  3.  
  4.  
  5. inSize = chest.size()
  6.  
  7. chest = peripheral.find("minecraft:chest")
  8.  
  9. x,y = mon.getSize()
  10.  
  11. monCenter = (x/2 + y/2)/2
  12.  
  13. slot = 0
  14.  
  15. currentItems = 0
  16. maxItems = 0
  17.  
  18. while true do
  19.     if slot >= inSize then
  20.         mon.setBackgroundColor(colors.gray)
  21.         mon.setTextColor(colors.red)
  22.         slot = slot - slot
  23.         mon.write(currentItems.. "/" ..maxItems)
  24.         sleep(15)
  25.     end    
  26.  
  27.     slot = slot + 1
  28.     item = chest.getItemDetail(slot)
  29.     itemlimit = chest.getItemLimit(slot)
  30.     mon.setBackgroundColor(colors.black)
  31.     mon.setTextColor(colors.white)
  32.     mon.setCursorPos(monCenter)
  33.     mon.write("Counting...")
  34.     currentItems = CurrentItems + item.count
  35.     maxItems = maxItems + itemlimit
  36.     sleep(1)
  37. end  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement