mirror of
https://github.com/HybridDog/nether-pack.git
synced 2025-01-27 01:40:19 +01:00
Moving functions around.
http://s2.quickmeme.com/img/d6/d6a1143f571184db25f94613edd43b40af6d3a629221aba00d9efdcfef5efd84.jpg
This commit is contained in:
parent
de1a29d6a5
commit
dfc9657885
@ -130,6 +130,43 @@ local function table_contains(t, v)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Function from vector_extras - added by Megaf.
|
||||
local function funcs.get_data_pos_table(tab)
|
||||
local t,n = {},1
|
||||
local minz, miny, minx, maxz, maxy, maxx
|
||||
for z,yxs in pairs(tab) do
|
||||
if not minz then
|
||||
minz = z
|
||||
maxz = z
|
||||
else
|
||||
minz = math.min(minz, z)
|
||||
maxz = math.max(maxz, z)
|
||||
end
|
||||
for y,xs in pairs(yxs) do
|
||||
if not miny then
|
||||
miny = y
|
||||
maxy = y
|
||||
else
|
||||
miny = math.min(miny, y)
|
||||
maxy = math.max(maxy, y)
|
||||
end
|
||||
for x,v in pairs(xs) do
|
||||
if not minx then
|
||||
minx = x
|
||||
maxx = x
|
||||
else
|
||||
minx = math.min(minx, x)
|
||||
maxx = math.max(maxx, x)
|
||||
end
|
||||
t[n] = {z,y,x, v}
|
||||
n = n+1
|
||||
end
|
||||
end
|
||||
end
|
||||
return t, {x=minx, y=miny, z=minz}, {x=maxx, y=maxy, z=maxz}, n-1
|
||||
end
|
||||
|
||||
|
||||
-- Weierstrass function stuff from https://github.com/slemonide/gen
|
||||
local SIZE = 1000
|
||||
local ssize = math.ceil(math.abs(SIZE))
|
||||
@ -763,7 +800,8 @@ local h_trunk_max = h_max-h_arm_max
|
||||
|
||||
function nether.grow_tree(pos, generated)
|
||||
local t1 = os.clock()
|
||||
|
||||
local ps, trmin, trmax, trunk_count = get_data_pos_table(trunks)
|
||||
|
||||
if not contents_defined then
|
||||
define_contents()
|
||||
contents_defined = true
|
||||
@ -830,41 +868,6 @@ function nether.grow_tree(pos, generated)
|
||||
local trunk_ps = {}
|
||||
local count = 0
|
||||
|
||||
local function funcs.get_data_pos_table(tab)
|
||||
local t,n = {},1
|
||||
local minz, miny, minx, maxz, maxy, maxx
|
||||
for z,yxs in pairs(tab) do
|
||||
if not minz then
|
||||
minz = z
|
||||
maxz = z
|
||||
else
|
||||
minz = math.min(minz, z)
|
||||
maxz = math.max(maxz, z)
|
||||
end
|
||||
for y,xs in pairs(yxs) do
|
||||
if not miny then
|
||||
miny = y
|
||||
maxy = y
|
||||
else
|
||||
miny = math.min(miny, y)
|
||||
maxy = math.max(maxy, y)
|
||||
end
|
||||
for x,v in pairs(xs) do
|
||||
if not minx then
|
||||
minx = x
|
||||
maxx = x
|
||||
else
|
||||
minx = math.min(minx, x)
|
||||
maxx = math.max(maxx, x)
|
||||
end
|
||||
t[n] = {z,y,x, v}
|
||||
n = n+1
|
||||
end
|
||||
end
|
||||
end
|
||||
return t, {x=minx, y=miny, z=minz}, {x=maxx, y=maxy, z=maxz}, n-1
|
||||
end
|
||||
|
||||
update_minmax(min, max, trmin)
|
||||
update_minmax(min, max, trmax)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user