@@ -2,7 +2,7 @@ name = "Block Finder"
22description = " Shows blocks in the world"
33
44--[[
5- by MCBE Craft
5+ by MCBE Craft + jqms (i converted it to findBlock)
66]]
77
88fileLib2 = importLib (" renderthreeD.lua" )
@@ -18,8 +18,9 @@ client.settings.addAir(5)
1818radius = 50
1919client .settings .addInt (" Finding block radius" , " radius" , 5 , 200 )
2020
21+ blockPos = {}
22+ --- @diagnostic disable-next-line : missing-parameter
2123registerCommand (" findBlock" , function (arguments )
22- blockPos = {}
2324 if (arguments == " " ) then
2425 return
2526 end
@@ -32,28 +33,13 @@ registerCommand("findBlock", function(arguments)
3233 end
3334 end
3435
35- local x , y , z = player .position ()
36- local sx = x - radius
37- local sy = y - radius
38- local sz = z - radius
39- local ex = sx + (2 * radius )
40- local ey = 100
41- local ez = sz + (2 * radius )
42-
4336 local text = " "
4437
45- for px = sx , ex do
46- for py = sy , ey do
47- for pz = sz , ez do
48- local block = dimension .getBlock (px , py , pz )
49- if (string.match (block .name :lower (), args [1 ]:lower ()) or block .id == tonumber (args [1 ]) and block .id ~= 0 ) then
50- text = text .. (block .name .. " : " .. px .. " " .. py .. " " .. pz .. " \n " )
51- table.insert (blockPos , { px , py , pz })
52- end
53- end
54- end
38+ local worldBlocks = dimension .findBlock (arguments , 0 , radius or 50 )
39+ for i , block in ipairs (worldBlocks ) do
40+ text = text .. (arguments .. " : " .. block [1 ] .. " " .. block [2 ] .. " " .. block [3 ] .. " \n " )
41+ table.insert (blockPos , { block [1 ], block [2 ], block [3 ] })
5542 end
56- print (text )
5743end )
5844
5945function render3d (dt )
0 commit comments