Advertisement
iekiekiek

plethora sending the item count of a chest

Dec 27th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. --use the plethora mod
  2. local modem = peripheral.wrap("top")
  3. local chest = peripheral.wrap("back")
  4. modem.open(1) --do nothing, never used
  5.  
  6. function state_of_chest()
  7.     local list_of_item = chest.list() --return the slot number and a table where the keys are "count","name","damage"
  8.     total = 0
  9.     for slot,info in pairs(list_of_item) do
  10.       if info.name == "minecraft:stone" then
  11.         total = total + info.count
  12.         end
  13.     end
  14.     modem.transmit(5,1,total) -- channel for sending, channel for the answer, message
  15. end
  16.  
  17. while true do
  18.     state_of_chest()
  19.     os.sleep(1)
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement