Advertisement
Grexxity

Villager test

May 23rd, 2025 (edited)
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. -- === Save Nice Greg Metadata to File ===
  2.  
  3. local sensor = peripheral.find("plethora:sensor")
  4. if not sensor then
  5.     print("❌ No Plethora sensor module found.")
  6.     return
  7. end
  8.  
  9. local radius = 8
  10. local entities = sensor.sense(radius)
  11. local file = fs.open("nicegreg_metadata.txt", "w")
  12.  
  13. file.writeLine("=== Nice Greg Metadata Dump ===\n")
  14.  
  15. local found = false
  16.  
  17. for _, e in ipairs(entities) do
  18.     if e.name == "Villager" and e.id then
  19.         local success, meta = pcall(sensor.getMetaByID, e.id)
  20.         if success and meta then
  21.             for k, v in pairs(meta) do
  22.                 file.writeLine(k .. ": " .. textutils.serialize(v))
  23.             end
  24.             found = true
  25.             break
  26.         end
  27.     end
  28. end
  29.  
  30. file.close()
  31.  
  32. if found then
  33.     print("✅ Metadata written to nicegreg_metadata.txt")
  34.     print("📝 Use 'edit nicegreg_metadata.txt' to view it.")
  35. else
  36.     print("❌ No villager metadata found.")
  37. end
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement