Advertisement
DabDaddy6223

servercheck

Apr 2nd, 2023 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. ItemCount = 15
  2.  
  3. function getListOfItems()
  4.     rednet.broadcast("items", "storage_check")
  5.     local itemCount = 0
  6.     local items = {}
  7.  
  8.     while itemCount < ItemCount do
  9.         local id, message = rednet.receive("storage_response")
  10.  
  11.         print(message)
  12.         itemCount = itemCount + 1
  13.         items[itemCount] = message
  14.     end
  15.    
  16.     return items
  17. end
  18.  
  19. function hasItem(itemname)
  20.     rednet.broadcast("Item: " .. itemname, "storage_check")
  21.     local id, message = rednet.receive("storage_response")
  22.     return message
  23. end
  24.  
  25. function main()
  26.     local modem = peripheral.find("modem", rednet.open)
  27.     -- local list = getListOfItems()
  28.  
  29.     -- for i = 1, #list do
  30.     --     print(list[i])
  31.     -- end
  32.     local itemInSystem = hasItem("minecraft:stone")
  33.     if itemInSystem then
  34.         print("Has Stone!")
  35.     else
  36.         print("No Stone!")
  37.     end
  38.  
  39.     local itemInSystemTwo = hasItem("minecraft:cobblestone")
  40.     if itemInSystemTwo then
  41.         print("Has Cobble!")
  42.     else
  43.         print("No Cobble!")
  44.     end
  45.  
  46. end
  47.  
  48. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement