Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local key = {
- ["minecraft:iron_ore"] = "iron",
- ["minecraft:deepslate_iron_ore"] = "iron",
- ["minecraft:gold_ore"] = "gold",
- ["minecraft:deepslate_gold_ore"] = "gold",
- ["minecraft:redstone_ore"] = "redstone",
- ["minecraft:deepslate_redstone_ore"] = "redstone",
- ["minecraft:emerald_ore"] = "emerald",
- ["minecraft:deepslate_emerald_ore"] = "emerald",
- ["minecraft:lapis_ore"] = "lapis",
- ["minecraft:deepslate_lapis_ore"] = "lapis",
- ["minecraft:diamond_ore"] = "diamond",
- ["minecraft:deepslate_diamond_ore"] = "diamond",
- -- "minecraft:nether_gold_ore",
- -- "minecraft:nether_quartz_ore",
- ["minecraft:ancient_debris"] = "netherite",
- ["tconstruct:cobalt_ore"] = "cobalt",
- ["alltheores:diamond_other_ore"] = "diamond",
- ["alltheores:emerald_other_ore"] = "emerald",
- ["alltheores:gold_other_ore"] = "gold",
- ["alltheores:iridium_ore"] = "iridium",
- ["alltheores:iridium_end_ore"] = "iridium",
- ["alltheores:iridium_nether_ore"] = "iridium",
- ["alltheores:iridium_other_ore"] = "iridium",
- ["alltheores:iridium_slate_ore"] = "iridium",
- ["alltheores:iron_other_ore"] = "iron",
- ["alltheores:lapis_other_ore"] = "lapis",
- ["alltheores:platinum_end_ore"] = "platinum",
- ["alltheores:platinum_ore"] = "platinum",
- ["alltheores:platinum_nether_ore"] = "platinum",
- ["alltheores:platinum_other_ore"] = "platinum",
- ["alltheores:platinum_slate_ore"] = "platinum",
- ["alltheores:quartz_other_ore"] = "quartz",
- ["alltheores:redstone_other_ore"] = "redstone",
- }
- local WHITELIST = {
- "minecraft:iron_ore",
- "minecraft:deepslate_iron_ore",
- "minecraft:gold_ore",
- "minecraft:deepslate_gold_ore",
- "minecraft:redstone_ore",
- "minecraft:deepslate_redstone_ore",
- "minecraft:emerald_ore",
- "minecraft:deepslate_emerald_ore",
- "minecraft:lapis_ore",
- "minecraft:deepslate_lapis_ore",
- "minecraft:diamond_ore",
- "minecraft:deepslate_diamond_ore",
- -- "minecraft:nether_gold_ore",
- -- "minecraft:nether_quartz_ore",
- "minecraft:ancient_debris",
- "tconstruct:cobalt_ore",
- "alltheores:diamond_other_ore",
- "alltheores:emerald_other_ore",
- "alltheores:gold_other_ore",
- "alltheores:iridium_ore",
- "alltheores:iridium_end_ore",
- "alltheores:iridium_nether_ore",
- "alltheores:iridium_other_ore",
- "alltheores:iridium_slate_ore",
- "alltheores:iron_other_ore",
- "alltheores:lapis_other_ore",
- "alltheores:platinum_end_ore",
- "alltheores:platinum_ore",
- "alltheores:platinum_nether_ore",
- "alltheores:platinum_other_ore",
- "alltheores:platinum_slate_ore",
- "alltheores:quartz_other_ore",
- "alltheores:redstone_other_ore",
- }
- table.includes = function(tbl, item)
- for i = 1, #tbl do
- if tbl[i] == item then
- return true
- end
- end
- return false
- end
- local geo = peripheral.find("geoScanner")
- local dat
- term.clear()
- while true do
- dat = geo.scan(12)
- if dat then
- local ores = {}
- for i, v in pairs(dat) do
- if table.includes(WHITELIST, v.name) then
- v.dist = math.abs(v.x) + math.abs(v.y) + math.abs(v.z)
- table.insert(ores, v)
- end
- end
- table.sort(ores, function(a, b)
- return a.dist < b.dist
- end)
- if #ores > 0 then
- term.clear()
- term.setCursorPos(1, 1)
- term.write(("%d, %d, %d : %s"):format(ores[1].x, ores[1].y, ores[1].z, key[ores[1].name]))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement