earthgen = {} local ENABLE_SNOW = false local DEBUG = false local DMAX = 20 local AREA_SIZE = 80 -- MINPOINT and MAXPOINT should be multiples of 16 -- MIDPOINT should be roughly between the two, but this is flexible -- MIDPOINT doesn't need to be a multiple of 16 -- Mapgens in other mods should exclude the MINPOINT to MAXPOINT -- region plus a safety margin of at least a mapchunk (80 nodes) earthgen.REALM_HEIGHT_MINPOINT = 26992 earthgen.REALM_HEIGHT_MIDPOINT = 29000 earthgen.REALM_HEIGHT_MAXPOINT = 30000 local earthgen_light = ocutil.numset ("earthgen_light") or 3 if earthgen_light < 1 then earthgen_light = 1 end if earthgen_light > 14 then earthgen_light = 14 end earthgen.debug_log = function (s) if false then ocutil.log ("[earthlog] " .. s) end end local gcid = minetest.get_content_id local modpath = minetest.get_modpath (minetest.get_current_modname()) dofile (modpath .. "/nodes.lua") c_air = gcid ("air") c_ignore = gcid ("ignore") c_water = gcid ("default:water_source") c_grass = gcid ("default:dirt_with_grass") c_dry_grass = gcid ("earthgen:dirt_with_dry_grass") c_dirt_snow = gcid ("default:dirt_with_snow") c_snow = gcid ("default:snow") c_sapling = gcid ("default:sapling") c_tree = gcid ("default:tree") c_leaves = gcid ("default:leaves") c_junglesapling = gcid ("default:junglesapling") c_jungletree = gcid ("default:jungletree") c_jungleleaves = gcid ("default:jungleleaves") c_savannasapling = gcid ("earthgen:savannasapling") c_savannatree = gcid ("earthgen:savannatree") c_savannaleaves = gcid ("earthgen:savannaleaves") c_pinesapling = gcid ("earthgen:pinesapling") c_pinetree = gcid ("earthgen:pinetree") c_pineleaves = gcid ("earthgen:pineleaves") c_dirt = gcid ("default:dirt") c_stone = gcid ("default:stone") c_water = gcid ("default:water_source") c_ice = gcid ("default:ice") c_sand = gcid ("default:sand") c_sandstone = gcid ("default:sandstone") c_desert_sand = gcid ("default:desert_sand") c_desert_stone = gcid ("default:desert_stone") c_snowblock = gcid ("default:snowblock") c_cactus = gcid ("default:cactus") c_grass_1 = gcid ("default:grass_1") c_grass_2 = gcid ("default:grass_2") c_grass_3 = gcid ("default:grass_3") c_grass_4 = gcid ("default:grass_4") c_grass_5 = gcid ("default:grass_5") c_jungle_grass = gcid ("default:junglegrass") c_dry_shrub = gcid ("default:dry_shrub") c_papyrus = gcid ("default:papyrus") c_grasses = { c_grass_1, c_grass_2, c_grass_3, c_grass_4, c_grass_5 } local cache = {} local function cliff(x, n) return 0.2*x*x - x + n*x - n*n*x*x - 0.01 * math.abs(x*x*x) + math.abs(x)*100*n*n*n*n end local function get_vn(x, z, noise, village) local vx, vz, vs = village.vx, village.vz, village.vs return (noise - 2) * 20 + (40 / (vs * vs)) * ((x - vx) * (x - vx) + (z - vz) * (z - vz)) end local function get_base_surface_at_point(x, z, vnoise, villages, ni, noise1, noise2, noise3, noise4) local index = 65536*x+z if cache[index] ~= nil then return cache[index] end cache[index] = 25*noise1[ni]+noise2[ni]*noise3[ni]/3 if cache [index] < 0 then x = math.abs (cache [index]) cache[index] = -(x+(x^0.3)) end if noise4[ni] > 0.8 then cache[index] = cliff(cache[index], noise4[ni]-0.8) end local s = 0 local t = 0 local noise = vnoise[ni] if t > 0 then cache[index] = s / t end return cache[index] end local function surface_at_point(x, z, ...) return get_base_surface_at_point(x, z, unpack({...})) end local SMOOTHED = AREA_SIZE + 2*DMAX local HSMOOTHED = AREA_SIZE + DMAX local INSIDE = AREA_SIZE - DMAX local function smooth(x, z, ...) local s=0 local w=0 for xi=-DMAX, DMAX do for zi=-DMAX, DMAX do local d2=xi*xi+zi*zi if d2=yy then -- add_leaves (data, a:index (xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_savannaleaves) lovem_leavem (data, a, xx, yy, zz, c_savannaleaves) end end end end end function add_savannabush(data, a, x, y, z, minp, maxp, pr) local bh = pr:next(1, 2) local bw = pr:next(2, 4) for xx=math.max(minp.x, x-bw), math.min(maxp.x, x+bw) do for zz=math.max(minp.z, z-bw), math.min(maxp.z, z+bw) do for yy=math.max(minp.y, y-bh), math.min(maxp.y, y+bh) do if pr:next(1, 100) < 95 and math.abs(xx-x) < pr:next(bh, bh+2)-math.abs(y-yy) and math.abs(zz-z) < pr:next(bh, bh+2)-math.abs(y-yy) then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_savannaleaves) lovem_leavem (data, a, xx, yy, zz, c_savannaleaves) for yyy=math.max(minp.y, yy-2), yy do -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yyy, zz), c_savannaleaves) lovem_leavem (data, a, xx, yyy, zz, c_savannaleaves) end end end end end if x<=maxp.x and x>=minp.x and y<=maxp.y and y>=minp.y and z<=maxp.z and z>=minp.z then local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + y, z) data[vi] = c_savannatree end end function add_pinetree(data, a, x, y, z, minp, maxp, pr, snow) if snow == nil then snow = c_snow end local th = pr:next(9, 13) for yy=math.max(minp.y, y), math.min(maxp.y, y+th) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + yy, z) data[vi] = c_pinetree end local maxy = y+th for xx=math.max(minp.x, x-3), math.min(maxp.x, x+3) do for yy=math.max(minp.y, maxy-1), math.min(maxp.y, maxy-1) do for zz=math.max(minp.z, z-3), math.min(maxp.z, z+3) do if pr:next(1, 100) < 80 then -- add_leaves (data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end for xx=math.max(minp.x, x-2), math.min(maxp.x, x+2) do for yy=math.max(minp.y, maxy), math.min(maxp.y, maxy) do for zz=math.max(minp.z, z-2), math.min(maxp.z, z+2) do if pr:next(1, 100) < 85 then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end for xx=math.max(minp.x, x-1), math.min(maxp.x, x+1) do for yy=math.max(minp.y, maxy+1), math.min(maxp.y, maxy+1) do for zz=math.max(minp.z, z-1), math.min(maxp.z, z+1) do if pr:next(1, 100) < 90 then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end if maxy+1<=maxp.y and maxy+1>=minp.y then -- add_leaves (data, a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + maxy+1, z), c_pineleaves, snow) lovem_leavem (data, a, x, maxy + 1, z, c_pineleaves, snow) -- add_leaves(data, a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + maxy+2, z), snow) lovem_leavem (data, a, x, maxy + 2, z, snow) end local my = 0 for i=1,20 do local xi = pr:next(x-3, x+2) local yy = pr:next(maxy-6, maxy-5) local zi = pr:next(z-3, z+2) if yy > my then my = yy end for xx=math.max(minp.x, xi), math.min(maxp.x, xi+1) do for zz=math.max(minp.z, zi), math.min(maxp.z, zi+1) do if minp.y<=yy and maxp.y>=yy then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end for xx=math.max(minp.x, x-2), math.min(maxp.x, x+2) do for yy=math.max(minp.y, my+1), math.min(maxp.y, my+1) do for zz=math.max(minp.z, z-2), math.min(maxp.z, z+2) do if pr:next(1, 100) < 85 then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end for xx=math.max(minp.x, x-1), math.min(maxp.x, x+1) do for yy=math.max(minp.y, my+2), math.min(maxp.y, my+2) do for zz=math.max(minp.z, z-1), math.min(maxp.z, z+1) do if pr:next(1, 100) < 90 then -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy, zz), c_pineleaves, snow) lovem_leavem (data, a, xx, yy, zz, c_pineleaves, snow) -- add_leaves(data, a:index(xx, earthgen.REALM_HEIGHT_MIDPOINT + yy+1, zz), snow) lovem_leavem (data, a, xx, yy+1, zz, snow) end end end end end dofile (modpath .. "/ores.lua") function get_biome_table(minp, humidity, temperature, range) if range == nil then range = 1 end local l = {} for xi = -range, range do for zi = -range, range do local mnp, mxp = {x=minp.x+xi*80,z=minp.z+zi*80}, {x=minp.x+xi*80+80,z=minp.z+zi*80+80} local pr = PseudoRandom(get_bseed(mnp)) local bxp, bzp = pr:next(mnp.x, mxp.x), pr:next(mnp.z, mxp.z) local h, t = humidity:get2d({x=bxp, y=bzp}), temperature:get2d({x=bxp, y=bzp}) l[#l+1] = {x=bxp, z=bzp, h=h, t=t} end end return l end local function get_distance(x1, x2, z1, z2) return (x1-x2)*(x1-x2)+(z1-z2)*(z1-z2) end function get_nearest_biome(biome_table, x, z) local m = math.huge local k = 0 for key, bdef in ipairs(biome_table) do local dist = get_distance(bdef.x, x, bdef.z, z) if dist= earthgen.REALM_HEIGHT_MAXPOINT then return end if emin.y < earthgen.REALM_HEIGHT_MINPOINT or emin.y >= earthgen.REALM_HEIGHT_MAXPOINT then return end local acminp = {x=minp.x,y=minp.y,z=minp.z}; local acmaxp = {x=maxp.x,y=maxp.y,z=maxp.z}; local acemin = {x=emin.x,y=emin.y,z=emin.z}; local acemax = {x=emax.x,y=emax.y,z=emax.z}; local a = VoxelArea:new{ MinEdge={x=emin.x, y=emin.y, z=emin.z}, MaxEdge={x=emax.x, y=emax.y, z=emax.z}, } minp.y = minp.y - earthgen.REALM_HEIGHT_MIDPOINT maxp.y = maxp.y - earthgen.REALM_HEIGHT_MIDPOINT emin.y = emin.y - earthgen.REALM_HEIGHT_MIDPOINT emax.y = emax.y - earthgen.REALM_HEIGHT_MIDPOINT local sidelen = maxp.x-minp.x+1 local noise1 = get_perlin_map(12345, 6, 0.5, 256, minp, maxp) local noise2 = get_perlin_map(56789, 6, 0.5, 256, minp, maxp) local noise3 = get_perlin_map(42, 3, 0.5, 32, minp, maxp) local noise4 = get_perlin_map(8954, 8, 0.5, 1024, minp, maxp) local noise1raw = minetest.get_perlin(12345, 6, 0.5, 256) local villages = {} local pr = PseudoRandom(get_bseed(minp)) local village_noise_map = get_perlin_map(7635, 3, 0.5, 16, minp, maxp) local noise_top_layer = get_perlin_map(654, 6, 0.5, 256, minp, maxp) local noise_second_layer = get_perlin_map(123, 6, 0.5, 256, minp, maxp) local noise_temperature_raw = minetest.get_perlin(763, 7, 0.5, 512) local noise_humidity_raw = minetest.get_perlin(834, 7, 0.5, 512) local noise_temperature = get_perlin_map(763, 7, 0.5, 512, minp, maxp) local noise_humidity = get_perlin_map(834, 7, 0.5, 512, minp, maxp) local noise_beach = get_perlin_map(452, 6, 0.5, 256, minp, maxp) local biome_table = get_biome_table (minp, noise_humidity_raw, noise_temperature_raw) local data = vm:get_data() local param2_data = vm:get_param2_data() local didtree = false local ni = 0 for z = minp.z, maxp.z do for x = minp.x, maxp.x do ni = ni + 1 local y = math.floor(surface_at_point(x, z, village_noise_map, villages, ni, noise1, noise2, noise3, noise4)) local humidity = noise_humidity[ni] local temperature = noise_temperature[ni] - math.max(y, 0) / 50 local biome = get_nearest_biome(biome_table, x, z) local biome_humidity = biome.h local biome_temperature = biome.t local liquid_top if biome_temperature < -0.4 then liquid_top = c_ice else liquid_top = c_water end local above_top, top, top_layer, second_layer if y < -1 then above_top = c_air top = c_dirt top_layer = c_dirt second_layer = c_stone elseif y < 3 and noise_beach[ni] < 0.2 then above_top = c_air top = c_sand top_layer = c_sand second_layer = c_sandstone else above_top = c_air if biome_temperature > 0.4 then if biome_humidity < -0.4 then top = c_desert_sand top_layer = c_desert_sand second_layer = c_desert_stone elseif biome_humidity < 0.4 then top = c_dry_grass top_layer = c_dirt second_layer = c_stone else top = c_grass top_layer = c_dirt second_layer = c_stone end elseif biome_temperature < -0.4 then above_top = c_snow top = c_dirt_snow top_layer = c_dirt second_layer = c_stone else top = c_grass top_layer = c_dirt second_layer = c_stone end if y > 0 and y < 100 and ((top == c_sand) or (top == c_desert_sand)) then if math.random (1,500) == 1 then above_top = c_cactus end end end if y >= 100 then above_top = c_air top = c_snow top_layer = c_snowblock end if y < 0 then above_top = c_air end if y <= maxp.y and y >= minp.y then local vi = a:index (x, earthgen.REALM_HEIGHT_MIDPOINT + y, z) if y >= 0 then data [vi] = top else data [vi] = top_layer end end local add_above_top = true for id, tree in ipairs(earthgen.registered_trees) do if tree.min_humidity <= humidity and humidity <= tree.max_humidity and tree.min_temperature <= temperature and temperature <= tree.max_temperature and tree.min_biome_humidity <= biome_humidity and biome_humidity <= tree.max_biome_humidity and tree.min_biome_temperature <= biome_temperature and biome_temperature <= tree.max_biome_temperature and tree.min_height <= y + 1 and y + 1 <= tree.max_height and ((not tree.grows_on) or tree.grows_on == top) and pr:next(1, tree.chance) == 1 then local in_village = false tree.grow(data, a, x, y + 1, z, minp, maxp, pr) didtree = true add_above_top = false break end end if add_above_top and y + 1 <= maxp.y and y + 1 >= minp.y then local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + y + 1, z) data[vi] = above_top end if y < 0 and minp.y <= 0 and maxp.y > y then for yy = math.max(y + 1, minp.y), math.min(0, maxp.y) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + yy, z) data[vi] = c_water end if maxp.y >= 0 then data[a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + 0, z)] = liquid_top end end local tl = math.floor((noise_top_layer[ni] + 2.5) * 2) if y - tl - 1 <= maxp.y and y - 1 >= minp.y then for yy = math.max(y - tl - 1, minp.y), math.min(y - 1, maxp.y) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + yy, z) data[vi] = top_layer end end local sl = math.floor ((noise_second_layer[ni] + 5) * 3) if y - sl - 1 <= maxp.y and y - tl - 2 >= minp.y then for yy = math.max(y - sl - 1, minp.y), math.min(y - tl - 2, maxp.y) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + yy, z) data[vi] = second_layer end end if y - sl - 2 >= minp.y then for yy = minp.y, math.min(y - sl - 2, maxp.y) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + yy, z) data[vi] = c_stone end end end end local va = VoxelArea:new{MinEdge=minp, MaxEdge=maxp} for _, ore_sheet in ipairs (earthgen.registered_ore_sheets) do local sidelen = maxp.x - minp.x + 1 local np = copytable(ore_sheet.noise_params) np.seed = np.seed + minp.y local pm = minetest.get_perlin_map(np, {x = sidelen, y = sidelen, z = 1}) local map = pm:get2dMap_flat({x = minp.x, y = minp.z}) local ni = 0 local trh = ore_sheet.threshhold local wherein = gcid (ore_sheet.wherein) local ore = gcid (ore_sheet.name) local hmin = ore_sheet.height_min local hmax = ore_sheet.height_max local tmin = ore_sheet.tmin local tmax = ore_sheet.tmax for z = minp.z, maxp.z do for x = minp.x, maxp.x do ni = ni + 1 local noise = map[ni] if noise > trh then local thickness = pr:next(tmin, tmax) local y0 = math.floor(minp.y + (noise - trh) * 4) for y = math.max(y0, hmin), math.min(y0 + thickness - 1, hmax) do local vi = a:index(x, earthgen.REALM_HEIGHT_MIDPOINT + y, z) if data[vi] == wherein or wherein == c_ignore then data[vi] = ore end end end end end end for _, ore in ipairs (earthgen.registered_ores) do generate_vein (gcid (ore.name) , gcid (ore.wherein), minp, maxp, ore.seed_diff, ore, data, a, va) end vm:set_data (data) vm:set_param2_data (param2_data) if acmaxp.y >= earthgen.REALM_HEIGHT_MIDPOINT-32 then vm:set_lighting ({ day=15, night=4 } , { x = acminp.x - 16, y = acminp.y - 16, z = acminp.z - 16 } , { x = acmaxp.x + 16, y = acmaxp.y + 16, z = acmaxp.z + 16 } ) else vm:set_lighting ({ day = earthgen_light , night = earthgen_light } , { x = acminp.x - 16, y = acminp.y - 16, z = acminp.z - 16 } , { x = acmaxp.x + 16, y = acmaxp.y + 16, z = acmaxp.z + 16 } ) end vm:calc_lighting ( { x = acminp.x - 16, y = acminp.y - 16, z = acminp.z - 16 } , { x = acmaxp.x + 16, y = acmaxp.y + 16, z = acmaxp.z + 16 } , false ) -- bug fix: vm:update_liquids() vm:write_to_map(data) end -- This code is based on jn's Bedrock mode (WTFPL) local bedrock = {} bedrock.layer = earthgen.REALM_HEIGHT_MINPOINT bedrock.node = { name = "earthgen:bedrock" } bedrock.digprop = { diggability = "not" } minetest.register_node ("earthgen:bedrock", { description = "Bedrock" , tiles = { "bedrock.png" } , material = bedrock.digprop , groups = { not_in_creative_inventory=1 } , }) minetest.register_on_generated (function (minp, maxp, seed) if maxp.y >= bedrock.layer and minp.y <= bedrock.layer then local p = {} local n = bedrock.node for x = minp.x,maxp.x do for z = minp.z,maxp.z do for y = bedrock.layer,maxp.y do p.x=x; p.z=z; p.y=y minetest.env:add_node (p, n) end end end return end local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") earthgen_generate (minp, maxp, emin, emax, vm) end) local function earthgen_regenerate(pos, name) local minp = {x = 80 * math.floor((pos.x + 32) / 80) - 32, y = 80 * math.floor((pos.y + 32) / 80) - 32, z = 80 * math.floor((pos.z + 32) / 80) - 32} local maxp = {x = minp.x + 79, y = minp.y + 79, z = minp.z + 79} local vm = minetest.get_voxel_manip() local emin, emax = vm:read_from_map(minp, maxp) local data = {} for i = 1, (maxp.x - minp.x + 1) * (maxp.y - minp.y + 1) * (maxp.z - minp.z + 1) do data[i] = c_air end vm:set_data(data) vm:write_to_map() earthgen_generate(minp, maxp, emin, emax, vm) minetest.chat_send_player(name, "Regenerating done, fixing lighting. This may take a while...") -- Fix lighting local nodes = minetest.find_nodes_in_area(minp, maxp, "air") local nnodes = #nodes local p = math.floor(nnodes / 5) local dig_node = minetest.dig_node for i, pos in ipairs(nodes) do dig_node(pos) if i % p == 0 then minetest.chat_send_player(name, math.floor(i / nnodes * 100).."%") end end minetest.chat_send_player(name, "Done") return minp, maxp end minetest.register_chatcommand("earthgen_regeneratex", { privs = {server = true}, func = function(name, param) local player = minetest.get_player_by_name(name) if player then local pos = player:getpos() local minp, maxp = earthgen_regenerate(pos, name) if minetest.get_modpath("biome_lib") and minp and maxp then biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = {minp, maxp} biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = {minp, maxp} end end end, }) earthgen.registered_ores = {} function earthgen.register_ore(oredef) if oredef.wherein == nil then oredef.wherein = "ignore" end if DEBUG then oredef.wherein = "ignore" oredef.maxheight = 31000 end earthgen.registered_ores[#earthgen.registered_ores+1] = oredef end earthgen.registered_ore_sheets = {} function earthgen.register_ore_sheet(oredef) if oredef.wherein == nil then oredef.wherein = "ignore" end if DEBUG then oredef.wherein = "ignore" oredef.height_max = 31000 end earthgen.registered_ore_sheets[#earthgen.registered_ore_sheets + 1] = oredef end earthgen.registered_trees = {} function earthgen.register_tree(treedef) if treedef.min_humidity == nil then treedef.min_humidity = -2 end if treedef.max_humidity == nil then treedef.max_humidity = 2 end if treedef.min_biome_humidity == nil then treedef.min_biome_humidity = -2 end if treedef.max_biome_humidity == nil then treedef.max_biome_humidity = 2 end if treedef.min_temperature == nil then treedef.min_temperature = -2 end if treedef.max_temperature == nil then treedef.max_temperature = 2 end if treedef.min_biome_temperature == nil then treedef.min_biome_temperature = -2 end if treedef.max_biome_temperature == nil then treedef.max_biome_temperature = 2 end earthgen.registered_trees[#earthgen.registered_trees + 1] = treedef end dofile(minetest.get_modpath(minetest.get_current_modname()).."/oredesc.lua") dofile(minetest.get_modpath(minetest.get_current_modname()).."/trees.lua") if ENABLE_SNOW then dofile(minetest.get_modpath(minetest.get_current_modname()).."/snow.lua") end