Advertisement
Lanzr

SPinter

Jun 16th, 2024 (edited)
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. local lst = peripheral.getNames()
  2.  
  3. local spType = "spawner_interface"
  4. local spList = {}
  5. local stoType = "minecraft:chest"
  6. local sto = nil
  7. local stoId = ""
  8. local cardID = "peripherals:spawner_card"
  9.  
  10. for key, value in pairs(lst) do
  11.     local type = peripheral.getType(value)
  12.     if(type == spType) then
  13.         table.insert(spList,peripheral.wrap(value))
  14.     elseif (type == stoType) then
  15.         stoId = value
  16.         sto = peripheral.wrap(value)
  17.     end
  18. end
  19. function checkSB()
  20.     term.clear()
  21.     term.setCursorPos(1,1)
  22.     for i, t in pairs(spList) do
  23.         local mob =  t.getCurrentlySpawningMob()
  24.         print("ID "..i.." : "..mob)
  25.     end
  26. end
  27.  
  28. function getChestSLot()
  29.     for i, j in pairs(sto.list()) do
  30.         local detail = sto.getItemDetail(i)
  31.         if(detail.name == cardID) then
  32.             if(string.len(detail.displayName) > 12)then
  33.                 return i
  34.             end
  35.         end
  36.     end
  37. end
  38.  
  39. repeat
  40.     checkSB()
  41.     print("input id to change:")
  42.     local num  = io.read()
  43.     num = tonumber(num)
  44.     if num ~= nil then
  45.         if num >0 and num < 5 then
  46.             spList[num].changeSpawner(stoId,getChestSLot())
  47.         end
  48.     end
  49. until num == nil
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement