Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- local ore = "diamonds"
- local radius = 16
- -- print("Starting with args: ")
- for i, ar in ipairs(args) do
- -- print(ar)
- if i == 1 then ore = ar end
- if i == 2 then radius = tonumber(ar) end
- end
- if radius > 16 then radius = 16 end
- if radius < 1 then radius = 1 end
- print("Scanning: " .. ore .. " with " .. radius .. " radius")
- sleep(3)
- function sortbydistance(a, b)
- -- print("( " .. a.x .. ", " .. a.y .. ", " .. a.z .. " ) / (" .. b.x .. ", " .. b.y .. ", " .. b.z .. " )")
- return ((math.abs(a.x) + math.abs(a.y) + math.abs(a.z)) < (math.abs(b.x) + math.abs(b.y) + math.abs(b.z)))
- end
- local geoscanner = peripheral.find("geoScanner")
- while true do
- local scan = geoscanner.scan(radius)
- -- print("test")
- if scan ~= nil then
- table.sort(scan, sortbydistance)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- for i, bData in ipairs(scan) do
- if bData.name == "minecraft:" .. ore .. "_ore" or bData.name == "minecraft:deepslate_" .. ore .. "_ore" then
- print(ore .. ": X" .. bData.x .. " Y" .. bData.y .. " Z" .. bData.z)
- end
- end
- end
- -- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement