1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
local p = peripheral.wrap"back"
assert(p.hasModule"plethora:scanner" and p.hasModule"plethora:glasses", "need block scanner and overlay glasses!")
--TODO: assert introspection+entity scan I think?
local sm, sw = 0.2, 0.6
local interesting = {
["minecraft:nether_quartz_ore"] = 0xffffff77,
["minecraft:nether_gold_ore"] = 0xffff0033,
["minecraft:chest"] = 0x00ff0099,
-- ["minecraft:cobblestone"] = 0x00cc0011,
["minecraft:ancient_debris"] = 0x99ff0099,
["minecraft:budding_amethyst"] = 0xff00ff99,
}
for k,v in pairs{
coal=0xaaaaaa33,
iron=0xbb667755,
copper=0x33773333,
gold=0xffff0033,
redstone=0xff000055,
emerald=0x00770077,
lapis=0x0000ff33,
diamond=0x00ffff77,
} do
interesting["minecraft:"..k.."_ore"] = v
interesting["minecraft:deepslate_"..k.."_ore"] = v
end
p.canvas3d().clear()
local canvas = p.canvas3d().create()
local function go()
local scan, player = p.scan(), p.getMetaOwner()
canvas.clear() canvas.recenter()
local wix,wiy,wiz = player.withinBlock.x, player.withinBlock.y, player.withinBlock.z
for _, block in ipairs(scan) do
local colour = interesting[block.name]
if colour then
local x,y,z = block.x-wix, block.y-wiy, block.z-wiz
local box = canvas.addBox(x+sm,y+sm,z+sm, sw,sw,sw, colour)
box.setDepthTested(false)
end
end
end
while true do go() os.sleep(0.5) end
|