Advertisement
AkaShiroKage

Filter Writer

Mar 19th, 2024 (edited)
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. local reader = peripheral.find("blockReader")
  2. local nbtStorage = peripheral.find("nbtStorage")
  3.  
  4. print(textutils.serialize(nbtStorage.read()))
  5.  
  6. local function getFilter()
  7. local data = reader.getBlockData()
  8. for k, v in pairs(data) do
  9. print(k, v)
  10. end
  11. return data
  12. end
  13.  
  14. local function generateJson(value)
  15. local baseJson =
  16. {
  17. Items =
  18. {
  19. {
  20. id = "productivebees:upgrade_filter",
  21. tag = {
  22. productivebees_allowed_bees = {
  23. value,
  24. },
  25. },
  26. Count = 1,
  27. Slot = 0,
  28. },
  29. },
  30. ForgeCaps = {},
  31. }
  32.  
  33. return textutils.serializeJSON(baseJson)
  34. end
  35.  
  36. local newValue = generateJson("productivebees:zombie")
  37.  
  38. local pass, err = nbtStorage.writeJson(newValue)
  39.  
  40. print(pass, err)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement