Advertisement
SirSheepe

Untitled

May 17th, 2023 (edited)
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. local key = {
  2. ["minecraft:iron_ore"] = "iron",
  3. ["minecraft:deepslate_iron_ore"] = "iron",
  4. ["minecraft:gold_ore"] = "gold",
  5. ["minecraft:deepslate_gold_ore"] = "gold",
  6. ["minecraft:redstone_ore"] = "redstone",
  7. ["minecraft:deepslate_redstone_ore"] = "redstone",
  8. ["minecraft:emerald_ore"] = "emerald",
  9. ["minecraft:deepslate_emerald_ore"] = "emerald",
  10. ["minecraft:lapis_ore"] = "lapis",
  11. ["minecraft:deepslate_lapis_ore"] = "lapis",
  12. ["minecraft:diamond_ore"] = "diamond",
  13. ["minecraft:deepslate_diamond_ore"] = "diamond",
  14. -- "minecraft:nether_gold_ore",
  15. -- "minecraft:nether_quartz_ore",
  16. ["minecraft:ancient_debris"] = "netherite",
  17. ["tconstruct:cobalt_ore"] = "cobalt",
  18. ["alltheores:diamond_other_ore"] = "diamond",
  19. ["alltheores:emerald_other_ore"] = "emerald",
  20. ["alltheores:gold_other_ore"] = "gold",
  21. ["alltheores:iridium_ore"] = "iridium",
  22. ["alltheores:iridium_end_ore"] = "iridium",
  23. ["alltheores:iridium_nether_ore"] = "iridium",
  24. ["alltheores:iridium_other_ore"] = "iridium",
  25. ["alltheores:iridium_slate_ore"] = "iridium",
  26. ["alltheores:iron_other_ore"] = "iron",
  27. ["alltheores:lapis_other_ore"] = "lapis",
  28. ["alltheores:platinum_end_ore"] = "platinum",
  29. ["alltheores:platinum_ore"] = "platinum",
  30. ["alltheores:platinum_nether_ore"] = "platinum",
  31. ["alltheores:platinum_other_ore"] = "platinum",
  32. ["alltheores:platinum_slate_ore"] = "platinum",
  33. ["alltheores:quartz_other_ore"] = "quartz",
  34. ["alltheores:redstone_other_ore"] = "redstone",
  35. }
  36.  
  37. local WHITELIST = {
  38. "minecraft:iron_ore",
  39. "minecraft:deepslate_iron_ore",
  40. "minecraft:gold_ore",
  41. "minecraft:deepslate_gold_ore",
  42. "minecraft:redstone_ore",
  43. "minecraft:deepslate_redstone_ore",
  44. "minecraft:emerald_ore",
  45. "minecraft:deepslate_emerald_ore",
  46. "minecraft:lapis_ore",
  47. "minecraft:deepslate_lapis_ore",
  48. "minecraft:diamond_ore",
  49. "minecraft:deepslate_diamond_ore",
  50. -- "minecraft:nether_gold_ore",
  51. -- "minecraft:nether_quartz_ore",
  52. "minecraft:ancient_debris",
  53. "tconstruct:cobalt_ore",
  54. "alltheores:diamond_other_ore",
  55. "alltheores:emerald_other_ore",
  56. "alltheores:gold_other_ore",
  57. "alltheores:iridium_ore",
  58. "alltheores:iridium_end_ore",
  59. "alltheores:iridium_nether_ore",
  60. "alltheores:iridium_other_ore",
  61. "alltheores:iridium_slate_ore",
  62. "alltheores:iron_other_ore",
  63. "alltheores:lapis_other_ore",
  64. "alltheores:platinum_end_ore",
  65. "alltheores:platinum_ore",
  66. "alltheores:platinum_nether_ore",
  67. "alltheores:platinum_other_ore",
  68. "alltheores:platinum_slate_ore",
  69. "alltheores:quartz_other_ore",
  70. "alltheores:redstone_other_ore",
  71. }
  72.  
  73. table.includes = function(tbl, item)
  74. for i = 1, #tbl do
  75. if tbl[i] == item then
  76. return true
  77. end
  78. end
  79. return false
  80. end
  81.  
  82. local geo = peripheral.find("geoScanner")
  83. local dat
  84.  
  85. term.clear()
  86.  
  87. while true do
  88. dat = geo.scan(12)
  89.  
  90. if dat then
  91. local ores = {}
  92.  
  93. for i, v in pairs(dat) do
  94. if table.includes(WHITELIST, v.name) then
  95. v.dist = math.abs(v.x) + math.abs(v.y) + math.abs(v.z)
  96. table.insert(ores, v)
  97. end
  98. end
  99.  
  100. table.sort(ores, function(a, b)
  101. return a.dist < b.dist
  102. end)
  103.  
  104. if #ores > 0 then
  105. term.clear()
  106. term.setCursorPos(1, 1)
  107. term.write(("%d, %d, %d : %s"):format(ores[1].x, ores[1].y, ores[1].z, key[ores[1].name]))
  108. end
  109. end
  110. end
  111.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement