#Simple Ore Distributor Tool

1 messages · Page 1 of 1 (latest)

cursive flint
#

Simple tool (far from vanilla generation btw, becase i suck at scripting
code

Code copyable from down below cus im too lazy to set up a github page

-- Written by Gentelhen

-- Define adjustable values
local density = $float(Ore Density, 0.002, 0.0, 0.100)$
local vein_low = $int(Min Vein Size, 8, 0, 27)$
local vein_high = $int(Max Vein Size, 8, 0, 27)$
local ore = $blockState(Ore, coal_ore)$
-- Define flexible values
local ore_size = 0
local ox = 0
local oy = 0
local oz = 0
-- Main body

if getBlock(x,y,z) == blocks.stone or getBlock(x,y,z) == blocks.deepslate then
if math.random() < density / 10 then -- If random chance is rolled
ore_size = math.random(vein_low,vein_high)
for i=0,ore_size do -- Set random parameters for placement of block
ox = math.random(x-1,x+1)
oy = math.random(y-1,y+1)
oz = math.random(z-1,z+1)
if getBlock(ox,oy,oz) == blocks.stone or getBlock(ox,oy,oz) == blocks.deepslate then -- actually places block
setBlock(ox, oy, oz, ore)
end
end
else
return nil
end
else
return nil
end

obtuse bramble
#

why not use simplex noise at a high threshold, it has a similar effect and is only a couple lines