summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ore2.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/ore2.lua b/ore2.lua
new file mode 100644
index 0000000..a50a718
--- /dev/null
+++ b/ore2.lua
@@ -0,0 +1,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
+