1
0
Fork 0

Add flat Nether; fix portals in flat world

This commit is contained in:
Wuzzy 2017-08-21 18:30:37 +02:00
parent 2e63dd0a3d
commit 8d9e46b535
3 changed files with 27 additions and 3 deletions

View File

@ -6,6 +6,8 @@ local nobj_cave = nil
local SPAWN_MIN = mcl_vars.mg_end_min+70
local SPAWN_MAX = mcl_vars.mg_end_min+98
local mg_name = minetest.get_mapgen_setting("mg_name")
-- 3D noise
local np_cave = {
@ -169,7 +171,10 @@ local function build_end_portal(pos, target3)
minetest.remove_node(newp)
end
else
if minetest.get_node(newp).name == "air" then
-- Build obsidian platform if floating
local newp_below = table.copy(newp)
newp_below.y = newp.y - 1
if minetest.get_node(newp).name == "air" and minetest.get_node(newp_below).name == "air" then
minetest.set_node(newp, {name="mcl_core:obsidian"})
end
@ -301,7 +306,11 @@ local function make_end_portal(pos)
local target3 = {x = p1.x, y = p1.y, z = p1.z}
target3.x = target3.x + 1
if target3.y < mcl_vars.mg_end_max and target3.y > mcl_vars.mg_end_min then
target3.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
if mg_name == "flat" then
target3.y = mcl_vars.mg_bedrock_overworld_max + 5
else
target3.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
end
else
target3.y = find_end_target3_y2(target3.x, target3.z)
end

View File

@ -9,6 +9,8 @@ local FRAME_SIZE_Y_MIN = 5
local FRAME_SIZE_X_MAX = 23
local FRAME_SIZE_Y_MAX = 23
local mg_name = minetest.get_mapgen_setting("mg_name")
-- 3D noise
local np_cave = {
offset = 0,
@ -180,6 +182,9 @@ local function build_portal(pos, target, is_rebuilding)
end
local function find_nether_target_y(target_x, target_z)
if mg_name == "flat" then
return mcl_vars.mg_bedrock_nether_bottom_max + 5
end
local start_y = mcl_vars.mg_nether_min + math.random(38, 117) -- Search start
if not nobj_cave then
nobj_cave = minetest.get_perlin(np_cave)
@ -306,7 +311,11 @@ local function make_portal(pos)
local target = {x = p1.x, y = p1.y, z = p1.z}
target.x = target.x + 1
if target.y < mcl_vars.mg_nether_max and target.y > mcl_vars.mg_nether_min then
target.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
if mg_name == "flat" then
target.y = mcl_vars.mg_bedrock_overworld_max + 5
else
target.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
end
else
target.y = find_nether_target_y(target.x, target.z)
end

View File

@ -1307,9 +1307,11 @@ minetest.register_on_generated(function(minp, maxp)
end
end
-- Bedrock, defined above
if setdata then
data[p_pos] = setdata
lvm_used = true
-- The void
elseif mcl_util.is_in_void({x=x,y=y,z=z}) then
data[p_pos] = c_void
lvm_used = true
@ -1341,6 +1343,10 @@ minetest.register_on_generated(function(minp, maxp)
elseif y >= mcl_vars.mg_realm_barrier_overworld_end_min and y <= mcl_vars.mg_realm_barrier_overworld_end_max then
data[p_pos] = c_realm_barrier
lvm_used = true
-- Flat Nether
elseif mg_name == "flat" and y >= mcl_vars.mg_bedrock_nether_bottom_max + 4 and y <= mcl_vars.mg_bedrock_nether_bottom_max + 52 then
data[p_pos] = c_air
lvm_used = true
-- Nether and End support for v6 because v6 does not support the biomes API
elseif mg_name == "v6" then
if y <= mcl_vars.mg_nether_max and y >= mcl_vars.mg_nether_min then