Merge pull request 'Grand mapgen cleanup II & End update' (#2639) from mapgen_cleanup into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2639
Reviewed-by: PrairieWind <prairie.astronomer1@gmail.com>
This commit is contained in:
cora 2022-09-14 21:08:40 +00:00
commit 20ccb6d21e
42 changed files with 2716 additions and 2294 deletions

View File

@ -162,7 +162,8 @@ end
mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 64, z = 0 }
mcl_vars.mg_end_exit_portal_pos = vector.new(0, mcl_vars.mg_end_min + 71, 0)
-- Realm barrier used to safely separate the End from the void below the Overworld
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max

View File

@ -61,6 +61,8 @@ mcl_item_entity.register_pickup_achievement("mcl_mobitems:leather", "mcl:killCow
mcl_item_entity.register_pickup_achievement("mcl_core:diamond", "mcl:diamonds")
mcl_item_entity.register_pickup_achievement("mcl_core:crying_obsidian", "mcl:whosCuttingOnions")
mcl_item_entity.register_pickup_achievement("mcl_nether:ancient_debris", "mcl:hiddenInTheDepths")
mcl_item_entity.register_pickup_achievement("mcl_end:dragon_egg", "mcl:PickUpDragonEgg")
mcl_item_entity.register_pickup_achievement("mcl_armor:elytra", "mcl:skysTheLimit")
local function check_pickup_achievements(object, player)
if has_awards then

View File

@ -303,10 +303,13 @@ end
-- set and return valid yaw
local set_yaw = function(self, yaw, delay, dtime)
if self.noyaw then return end
if true then
self.object:set_yaw(yaw)
return yaw
end
if not yaw or yaw ~= yaw then
yaw = 0
end
@ -4069,6 +4072,7 @@ minetest.register_entity(name, {
ignited_by_sunlight = def.ignited_by_sunlight or false,
spawn_in_group = def.spawn_in_group,
spawn_in_group_min = def.spawn_in_group_min,
noyaw = def.noyaw or false,
-- End of MCL2 extensions
on_spawn = def.on_spawn,

View File

@ -4,6 +4,50 @@
local S = minetest.get_translator("mobs_mc")
local BEAM_CHECK_FREQUENCY = 2
local POS_CHECK_FREQUENCY = 15
local HEAL_AMMOUNT = 37
local function heal(self)
local o = self.object
self.health = math.min(self.hp_max,self.health + HEAL_AMMOUNT)
end
local function check_beam(self)
for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do
local luaentity = obj:get_luaentity()
if luaentity and luaentity.name == "mcl_end:crystal" then
if luaentity.beam then
if luaentity.beam == self.beam then
heal(self)
break
end
else
if self.beam then
self.beam:remove()
end
minetest.add_entity(self.object:get_pos(), "mcl_end:crystal_beam"):get_luaentity():init(self.object, obj)
break
end
end
end
end
local function check_pos(self)
if self._portal_pos then
-- migrate old format
if type(self._portal_pos) == "string" then
self._portal_pos = minetest.string_to_pos(self._portal_pos)
end
local portal_center = vector.add(self._portal_pos, vector.new(0, 11, 0))
local pos = self.object:get_pos()
if vector.distance(pos, portal_center) > 50 then
self.object:set_pos(self._last_good_pos or portal_center)
else
self._last_good_pos = pos
end
end
end
mcl_mobs:register_mob("mobs_mc:enderdragon", {
description = S("Ender Dragon"),
type = "monster",
@ -23,7 +67,7 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
{"mobs_mc_dragon.png"},
},
visual_size = {x=3, y=3},
view_range = 35,
view_range = 64,
walk_velocity = 6,
run_velocity = 6,
can_despawn = false,
@ -61,45 +105,33 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
run_start = 0, run_end = 20,
},
ignores_nametag = true,
do_custom = function(self)
do_custom = function(self,dtime)
mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple")
for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do
local luaentity = obj:get_luaentity()
if luaentity and luaentity.name == "mcl_end:crystal" then
if luaentity.beam then
if luaentity.beam == self.beam then
break
end
else
if self.beam then
self.beam:remove()
end
minetest.add_entity(self.object:get_pos(), "mcl_end:crystal_beam"):get_luaentity():init(self.object, obj)
break
end
end
if self._pos_timer == nil or self._pos_timer > POS_CHECK_FREQUENCY then
self._pos_timer = 0
check_pos(self)
end
if self._portal_pos then
-- migrate old format
if type(self._portal_pos) == "string" then
self._portal_pos = minetest.string_to_pos(self._portal_pos)
end
local portal_center = vector.add(self._portal_pos, vector.new(3, 11, 3))
local pos = self.object:get_pos()
if vector.distance(pos, portal_center) > 50 then
self.object:set_pos(self._last_good_pos or portal_center)
else
self._last_good_pos = pos
end
if self._beam_timer == nil or self._beam_timer > BEAM_CHECK_FREQUENCY then
self._beam_timer = 0
check_beam(self)
end
self._beam_timer = self._beam_timer + dtime
self._pos_timer = self._pos_timer + dtime
end,
on_die = function(self, pos)
on_die = function(self, pos, cmi_cause)
if self._portal_pos then
mcl_portals.spawn_gateway_portal()
mcl_structures.call_struct(self._portal_pos, "end_exit_portal_open")
mcl_structures.place_structure(self._portal_pos,mcl_structures.registered_structures["end_exit_portal_open"],PseudoRandom(minetest.get_mapgen_setting("seed")),-1)
if self._initial then
mcl_experience.throw_xp(pos, 11500) -- 500 + 11500 = 12000
minetest.set_node(vector.add(self._portal_pos, vector.new(3, 5, 3)), {name = "mcl_end:dragon_egg"})
minetest.set_node(vector.add(self._portal_pos, vector.new(0, 5, 0)), {name = "mcl_end:dragon_egg"})
end
end
-- Free The End Advancement
for _,players in pairs(minetest.get_objects_inside_radius(pos,64)) do
if players:is_player() then
awards.unlock(players:get_player_name(), "mcl:freeTheEnd")
end
end
end,

View File

@ -632,7 +632,12 @@ mcl_mobs:spawn_specific(
"end",
"ground",
{
"End"
"End",
"EndIsland",
"EndMidlands",
"EndBarrens",
"EndBorder",
"EndSmallIslands"
},
0,
minetest.LIGHT_MAX+1,
@ -797,7 +802,7 @@ mcl_mobs:spawn_specific(
"ground",
{
"Nether",
"SoulsandVall3ey",
"SoulsandValley",
},
0,
11,

View File

@ -9,8 +9,27 @@ local S = minetest.get_translator("mobs_mc")
--################### SHULKER
--###################
local adjacents = {
vector.new(1,0,0),
vector.new(-1,0,0),
vector.new(0,1,0),
vector.new(0,-1,0),
vector.new(0,0,1),
vector.new(0,0,-1),
}
local function check_spot(pos)
pos = vector.offset(pos,0,0.5,0)
local n = minetest.get_node(pos)
if n.name ~="air" then return false end
for _,a in pairs(adjacents) do
local p = vector.add(pos,a)
local pn = minetest.get_node(p)
if minetest.get_item_group(pn.name,"solid") > 0 then return true end
end
return false
end
local pr = PseudoRandom(os.time()*(-334))
-- animation 45-80 is transition between passive and attack stance
mcl_mobs:register_mob("mobs_mc:shulker", {
description = S("Shulker"),
type = "monster",
@ -35,6 +54,8 @@ mcl_mobs:register_mob("mobs_mc:shulker", {
walk_chance = 0,
knock_back = false,
jump = false,
can_despawn = false,
fall_speed = 0,
drops = {
{name = "mcl_mobitems:shulker_shell",
chance = 2,
@ -44,15 +65,90 @@ mcl_mobs:register_mob("mobs_mc:shulker", {
looting_factor = 0.0625},
},
animation = {
stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25,
stand_speed = 25, walk_speed = 0, run_speed = 50, punch_speed = 25,
speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 45,
walk_start = 0, walk_end = 45,
run_start = 0, run_end = 45,
stand_start = 0, stand_end = 25,
walk_start = 25, walk_end = 45,
run_start = 45, run_end = 85,
punch_start = 80, punch_end = 100,
},
view_range = 16,
fear_height = 4,
fear_height = 0,
noyaw = true,
do_custom = function(self,dtime)
local pos = self.object:get_pos()
if math.floor(self.object:get_yaw()) ~=0 then
self.object:set_yaw(0)
mcl_mobs:yaw(self, 0, 0, dtime)
end
if self.state == "walk" or self.state == "stand" then
self.state = "stand"
mcl_mobs:set_animation(self, "stand")
end
if self.state == "attack" then
mcl_mobs:set_animation(self, "punch")
end
self.path.way = false
self.look_at_players = false
if not check_spot(pos) then
self:teleport(nil)
end
end,
do_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
self:teleport(puncher)
end,
do_teleport = function(self, target)
if target ~= nil then
local target_pos = target:get_pos()
-- Find all solid nodes below air in a 10×10×10 cuboid centered on the target
local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(target_pos, 5), vector.add(target_pos, 5), {"group:solid", "group:cracky", "group:crumbly"})
local telepos
if nodes ~= nil then
if #nodes > 0 then
-- Up to 64 attempts to teleport
for n=1, math.min(64, #nodes) do
local r = pr:next(1, #nodes)
local nodepos = nodes[r]
local tg = vector.offset(nodepos,0,1,0)
if check_spot(tg) then
telepos = tg
node_ok = true
end
end
if telepos then
self.object:set_pos(telepos)
end
end
end
else
local pos = self.object:get_pos()
-- Up to 8 top-level attempts to teleport
for n=1, 8 do
local node_ok = false
-- We need to add (or subtract) different random numbers to each vector component, so it couldn't be done with a nice single vector.add() or .subtract():
local randomCube = vector.new( pos.x + 8*(pr:next(0,16)-8), pos.y + 8*(pr:next(0,16)-8), pos.z + 8*(pr:next(0,16)-8) )
local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(randomCube, 4), vector.add(randomCube, 4), {"group:solid", "group:cracky", "group:crumbly"})
if nodes ~= nil then
if #nodes > 0 then
-- Up to 8 low-level (in total up to 8*8 = 64) attempts to teleport
for n=1, math.min(8, #nodes) do
local r = pr:next(1, #nodes)
local nodepos = nodes[r]
local tg = vector.offset(nodepos,0,1,0)
if check_spot(tg) then
self.object:set_pos(tg)
node_ok = true
break
end
end
end
end
if node_ok then
break
end
end
end
end,
})
-- bullet arrow (weapon)
@ -82,7 +178,7 @@ mcl_mobs:register_arrow("mobs_mc:shulkerbullet", {
mcl_mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0)
--[[
mcl_mobs:spawn_specific(
"mobs_mc:shulker",
"end",
@ -97,3 +193,4 @@ minetest.LIGHT_MAX+1,
2,
mcl_vars.mg_end_min,
mcl_vars.mg_end_max)
--]]

View File

@ -148,6 +148,18 @@ awards.register_achievement("mcl:hiddenInTheDepths", {
icon = "mcl_nether_ancient_debris_side.png",
})
awards.register_achievement("mcl:PickUpDragonEgg", {
title = S("The Next Generation"),
description = S("Hold the Dragon Egg.\nHint: Pick up the egg from the ground and have it in your inventory."),
icon = "mcl_end_dragon_egg.png",
})
awards.register_achievement("mcl:skysTheLimit", {
title = S("Sky's the Limit"),
description = S("Find the elytra and prepare to fly above and beyond!"),
icon = "mcl_armor_inv_elytra.png",
}) -- TODO: Make also unlock when moved to inventory, not just picking up from ground
-- Smelting achivements: These are awarded when picking up an item from a furnace
-- output. They are given in mcl_furnaces.
awards.register_achievement("mcl:acquireIron", {
@ -237,6 +249,12 @@ awards.register_achievement("mcl:witheringHeights", {
icon = "mcl_mobitems_nether_star.png",
})
awards.register_achievement("mcl:freeTheEnd", {
title = S("Free the End"),
description = S("Kill the ender dragon. Good Luck!"),
icon = "mobs_mc_spawn_icon_dragon.png", -- TODO: Dragon Head Icon
})
-- Triggered in mcl_fishing
awards.register_achievement("mcl:fishyBusiness", {
title = S("Fishy Business"),
@ -285,6 +303,13 @@ awards.register_achievement("mcl:maxed_beacon", {
icon = "beacon_achievement_icon.png",
})
-- Triggered in mcl_end
awards.register_achievement("mcl:theEndAgain", {
title = S("The End... Again..."),
description = S("Respawn the Ender Dragon."),
icon = "mcl_end_crystal_item.png",
})
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
if non_pc_achievements then

View File

@ -79,3 +79,11 @@ Bring Home the Beacon=
Use a beacon.=
Beaconator=
Use a fully powered beacon.=
The Next Generation=
Hold the Dragon Egg.@nHint: Pick up the egg from the ground and have it in your inventory.=
The End... Again...=
Respawn the Ender Dragon.=
Sky's The Limit=
Find the elytra and prepare to fly above and beyond!=
Free the End=
Kill the ender dragon. Good Luck!=

View File

@ -1,21 +1,15 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
--local layer_max = mcl_worlds.layer_to_y(16)
--local layer_min = mcl_vars.mg_overworld_min
local copper_mod = minetest.get_modpath("mcl_copper")
local cobble = "mcl_deepslate:deepslate_cobbled"
local stick = "mcl_core:stick"
--[[
local mountains = {
"ExtremeHills", "ExtremeHills_beach", "ExtremeHills_ocean", "ExtremeHills_deep_ocean", "ExtremeHills_underground",
"ExtremeHills+", "ExtremeHills+_ocean", "ExtremeHills+_deep_ocean", "ExtremeHills+_underground",
"ExtremeHillsM", "ExtremeHillsM_ocean", "ExtremeHillsM_deep_ocean", "ExtremeHillsM_underground",
}
]]
local function spawn_silverfish(pos, oldnode, oldmetadata, digger)
if not minetest.is_creative_enabled("") then
minetest.add_entity(pos, "mobs_mc:silverfish")
end
end
minetest.register_node("mcl_deepslate:deepslate", {
description = S("Deepslate"),
@ -34,12 +28,6 @@ minetest.register_node("mcl_deepslate:deepslate", {
_mcl_silk_touch_drop = true,
})
local function spawn_silverfish(pos, oldnode, oldmetadata, digger)
if not minetest.is_creative_enabled("") then
minetest.add_entity(pos, "mobs_mc:silverfish")
end
end
minetest.register_node("mcl_deepslate:infested_deepslate", {
description = S("Infested Deepslate"),
_doc_items_longdesc = S("An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart."),
@ -198,173 +186,6 @@ minetest.register_node("mcl_deepslate:deepslate_with_redstone_lit", {
},
})
minetest.register_craft({
type = "cooking",
output = "mesecons:redstone",
recipe = "mcl_deepslate:deepslate_with_redstone",
cooktime = 10,
})
--[[ Commented out for now because there the discussion how to handle this is ongoing
minetest.register_ore({
ore_type = "blob",
ore = "mcl_deepslate:deepslate",
wherein = { "mcl_core:stone" },
clust_scarcity = 200,
clust_num_ores = 100,
clust_size = 10,
y_min = layer_min,
y_max = layer_max,
noise_params = {
offset = 0,
scale = 1,
spread = { x = 250, y = 250, z = 250 },
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_ore({
ore_type = "blob",
ore = "mcl_deepslate:tuff",
wherein = { "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite", "mcl_deepslate:deepslate" },
clust_scarcity = 10*10*10,
clust_num_ores = 58,
clust_size = 7,
y_min = layer_min,
y_max = layer_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_deepslate:infested_deepslate",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 26 * 26 * 26,
clust_num_ores = 3,
clust_size = 2,
y_min = layer_min,
y_max = layer_max,
biomes = mountains,
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:water_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(5),
y_max = layer_max,
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 2000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(1),
y_max = mcl_worlds.layer_to_y(10),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(11),
y_max = layer_max,
})
if minetest.settings:get_bool("mcl_generate_ores", true) then
local stonelike = { "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite" }
local function register_ore_mg(ore, scarcity, num, size, y_min, y_max, biomes)
biomes = biomes or ""
minetest.register_ore({
ore_type = "scatter",
ore = ore,
wherein = { "mcl_deepslate:deepslate", "mcl_deepslate:tuff" },
clust_scarcity = scarcity,
clust_num_ores = num,
clust_size = size,
y_min = y_min,
y_max = y_max,
biomes = biomes,
})
end
local ore_mapgen = {
{ "coal", 1575, 5, 3, layer_min, layer_max },
{ "coal", 1530, 8, 3, layer_min, layer_max },
{ "coal", 1500, 12, 3, layer_min, layer_max },
{ "iron", 830, 5, 3, layer_min, layer_max },
{ "gold", 4775, 5, 3, layer_min, layer_max },
{ "gold", 6560, 7, 3, layer_min, layer_max },
{ "diamond", 10000, 4, 3, layer_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 5000, 2, 3, layer_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 10000, 8, 3, layer_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 20000, 1, 1, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "diamond", 20000, 2, 2, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "redstone", 500, 4, 3, layer_min, mcl_worlds.layer_to_y(13) },
{ "redstone", 800, 7, 4, layer_min, mcl_worlds.layer_to_y(13) },
{ "redstone", 1000, 4, 3, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "redstone", 1600, 7, 4, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "lapis", 10000, 7, 4, mcl_worlds.layer_to_y(14), layer_max },
{ "lapis", 12000, 6, 3, mcl_worlds.layer_to_y(10), mcl_worlds.layer_to_y(13) },
{ "lapis", 14000, 5, 3, mcl_worlds.layer_to_y(6), mcl_worlds.layer_to_y(9) },
{ "lapis", 16000, 4, 3, mcl_worlds.layer_to_y(2), mcl_worlds.layer_to_y(5) },
{ "lapis", 18000, 3, 2, mcl_worlds.layer_to_y(0), mcl_worlds.layer_to_y(2) },
}
for _, o in pairs(ore_mapgen) do
register_ore_mg("mcl_deepslate:deepslate_with_"..o[1], o[2], o[3], o[4], o[5], o[6])
end
if minetest.get_mapgen_setting("mg_name") == "v6" then
register_ore_mg("mcl_deepslate:deepslate_with_emerald", 14340, 1, 1, layer_min, layer_max)
else
register_ore_mg("mcl_deepslate:deepslate_with_emerald", 16384, 1, 1, mcl_worlds.layer_to_y(4), layer_max, mountains)
end
if copper_mod then
register_ore_mg("mcl_deepslate:deepslate_with_copper", 830, 5, 3, layer_min, layer_max)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_copper:stone_with_copper",
wherein = stonelike,
clust_scarcity = 830,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(39),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_copper:stone_with_copper",
wherein = stonelike,
clust_scarcity = 1660,
clust_num_ores = 4,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(40),
y_max = mcl_worlds.layer_to_y(63),
})
end
end
--]]
local function register_deepslate_variant(item, desc, longdesc)
local texture = desc:lower():gsub("% ", "_")
local def = {
@ -424,6 +245,13 @@ for _, p in pairs({ "bricks", "tiles" }) do
})
end
minetest.register_craft({
type = "cooking",
output = "mesecons:redstone",
recipe = "mcl_deepslate:deepslate_with_redstone",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_deepslate:deepslate",

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator(minetest.get_current_modname())
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local vector = vector
local explosion_strength = 6
@ -65,12 +67,20 @@ local function spawn_crystal(pos)
crystals[i] = find_crystal(crystal_pos)
if not crystals[i] then return end
end
for _,o in pairs(minetest.get_objects_inside_radius(pos,64)) do
local l = o:get_luaentity()
if l and l.name == "mobs_mc:enderdragon" then return end
if not peaceful then
if o:is_player() then
awards.unlock(o:get_player_name(), "mcl:theEndAgain")
end
end
end
for _, crystal in pairs(crystals) do
crystal_explode(crystal)
end
local portal_pos = vector.add(portal_center, vector.new(-3, -1, -3))
mcl_structures.call_struct(portal_pos, "end_exit_portal")
minetest.add_entity(vector.add(portal_pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = portal_pos
local portal_pos = vector.add(portal_center, vector.new(0, -1, 0))
mcl_structures.place_structure(portal_pos,mcl_structures.registered_structures["end_exit_portal"],PseudoRandom(minetest.get_mapgen_setting("seed")),-1)
end
minetest.register_entity("mcl_end:crystal", {

View File

@ -1,3 +1,4 @@
mcl_itemframes = {}
local S = minetest.get_translator(minetest.get_current_modname())
local VISUAL_SIZE = 0.3
@ -132,6 +133,7 @@ local update_item_entity = function(pos, node, param2)
end
end
end
mcl_itemframes.update_item_entity = update_item_entity
local drop_item = function(pos, node, meta, clicker)
local cname = ""

View File

@ -1,4 +1,4 @@
name = mcl_portals
description = Adds buildable portals to the Nether and End dimensions.
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits, mcl_structures
optional_depends = awards, doc

View File

@ -906,3 +906,18 @@ minetest.override_item(OBSIDIAN, {
end
end,
})
mcl_structures.register_structure("nether_portal",{
nospawn = true,
filenames = {
modpath.."/schematics/mcl_portals_nether_portal.mts"
},
after_place = function(pos,def,pr,blockseed)
end
})
mcl_structures.register_structure("nether_portal_open",{
nospawn = true,
filenames = {
modpath.."/schematics/mcl_portals_nether_portal_open.mts"
},
})

View File

@ -69,16 +69,16 @@ local function update_pane(pos)
end
minetest.register_on_placenode(function(pos, node)
if minetest.get_item_group(node, "pane") then
update_pane(pos)
end
if minetest.get_item_group(node.name, "pane") <= 0 then return end
update_pane(pos)
for i = 0, 3 do
local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir))
end
end)
minetest.register_on_dignode(function(pos)
minetest.register_on_dignode(function(pos,node)
if minetest.get_item_group(node.name, "pane") <= 0 then return end
for i = 0, 3 do
local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir))
@ -86,6 +86,7 @@ minetest.register_on_dignode(function(pos)
end)
xpanes = {}
xpanes.update_pane = update_pane
function xpanes.register_pane(name, def)
for i = 1, 15 do
minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat")

View File

@ -13,9 +13,6 @@ local mod_mcl_crimson = minetest.get_modpath("mcl_crimson")
local mod_mcl_blackstone = minetest.get_modpath("mcl_blackstone")
local mod_mcl_mangrove = minetest.get_modpath("mcl_mangrove")
-- Jungle bush schematic. In PC/Java Edition it's Jungle Wood + Oak Leaves
local jungle_bush_schematic = mod_mcl_core.."/schematics/mcl_core_jungle_bush_oak_leaves.mts"
local deco_id_chorus_plant
--
@ -1727,12 +1724,90 @@ local function register_dimension_biomes()
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
-- FIXME: For some reason the End stops generating early if this constant is not added.
-- Figure out why.
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80,
heat_point = 1000, --ridiculously high values so End Island always takes precedent
humidity_point = 1000,
vertical_blend = 16,
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
minetest.register_biome({
name = "EndMidlands",
node_stone = "air",
node_filler = "air",
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80,
heat_point = 1000,
humidity_point = 1000,
vertical_blend = 16,
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
minetest.register_biome({
name = "EndHighlands",
node_stone = "air",
node_filler = "air",
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80,
heat_point = 1000,
humidity_point = 1000,
vertical_blend = 16,
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
minetest.register_biome({
name = "EndSmallIslands",
node_stone = "air",
node_filler = "air",
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80,
heat_point = 1000,
humidity_point = 1000,
vertical_blend = 16,
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
minetest.register_biome({
name = "EndBorder",
node_stone = "air",
node_filler = "air",
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80,
heat_point = 500,
humidity_point = 500,
vertical_blend = 16,
max_pos = {x = 1250, y = mcl_vars.mg_end_min + 512, z = 1250},
min_pos = {x = -1250, y = mcl_vars.mg_end_min, z = -1250},
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
minetest.register_biome({
name = "EndIsland",
node_stone = "air",
node_filler = "air",
node_water = "air",
node_river_water = "air",
node_cave_liquid = "air",
max_pos = {x = 650, y = mcl_vars.mg_end_min + 512, z = 650},
min_pos = {x = -650, y = mcl_vars.mg_end_min, z = -650},
heat_point = 50,
humidity_point = 50,
vertical_blend = 16,
_mcl_biome_type = "medium",
_mcl_palette_index = 0,
})
@ -2382,10 +2457,47 @@ local function register_dimension_ores()
end_wherein = {"air"}
end
local mult = 1.0
minetest.register_ore({
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
biomes = {"EndSmallIslands","Endborder"},
y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80,
clust_num_ores = 3375,
clust_size = 15,
noise_params = {
offset = mcl_vars.mg_end_min+70,
scale = -1,
spread = {x=84, y=84, z=84},
seed = 145,
octaves = 3,
persist = 0.6,
lacunarity = 2,
--flags = "defaults",
},
np_stratum_thickness = {
offset = 0,
scale = 15,
spread = {x=84, y=84, z=84},
seed = 145,
octaves = 3,
persist = 0.6,
lacunarity = 2,
--flags = "defaults",
},
clust_scarcity = 1,
})
minetest.register_ore({
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
biomes = {"End","EndMidlands","EndHighlands","EndBarrens"},
y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80,
@ -2413,6 +2525,7 @@ local function register_dimension_ores()
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
biomes = {"End","EndMidlands","EndHighlands","EndBarrens"},
y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80,
@ -2439,6 +2552,7 @@ local function register_dimension_ores()
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
biomes = {"End","EndMidlands","EndHighlands","EndBarrens"},
y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80,
@ -3149,13 +3263,13 @@ local function register_decorations()
-- Jungle tree
-- Huge jungle tree (2 variants)
for i=1, 2 do
-- Huge jungle tree (4 variants)
for i=1, 4 do
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.00125,
fill_ratio = 0.0008,
biomes = {"Jungle"},
y_min = 4,
y_max = mcl_vars.mg_overworld_max,
@ -3167,7 +3281,7 @@ local function register_decorations()
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.004,
fill_ratio = 0.003,
biomes = {"JungleM"},
y_min = 4,
y_max = mcl_vars.mg_overworld_max,
@ -3182,7 +3296,55 @@ local function register_decorations()
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.045,
fill_ratio = 0.025,
biomes = {"Jungle"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.015,
biomes = {"Jungle"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree_2.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.005,
biomes = {"Jungle"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree_3.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.005,
biomes = {"Jungle"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree_4.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
fill_ratio = 0.025,
biomes = {"Jungle"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
@ -3211,11 +3373,10 @@ local function register_decorations()
biomes = {"JungleM"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree.mts",
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_tree_2.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Spruce
local function quick_spruce(seed, offset, sprucename, biomes, y)
if not y then
@ -3538,6 +3699,18 @@ local function register_decorations()
rotation = "0",
})
--Snow on snowy dirt
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:dirt_with_grass_snow"},
sidelen = 80,
fill_ratio = 10,
flags = "all_floors",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
decoration = "mcl_core:snow",
})
--Mushrooms in caves
minetest.register_decoration({
deco_type = "simple",
@ -3800,7 +3973,7 @@ local function register_decorations()
sidelen = 80,
noise_params = {
offset = 0.0196,
scale = 0.025,
scale = 0.015,
spread = {x = 250, y = 250, z = 250},
seed = 2930,
octaves = 4,
@ -3809,7 +3982,25 @@ local function register_decorations()
biomes = {"Jungle"},
y_min = 3,
y_max = mcl_vars.mg_overworld_max,
schematic = jungle_bush_schematic,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80,
noise_params = {
offset = 0.0196,
scale = 0.005,
spread = {x = 250, y = 250, z = 250},
seed = 2930,
octaves = 4,
persist = 0.6,
},
biomes = {"Jungle"},
y_min = 3,
y_max = mcl_vars.mg_overworld_max,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_bush_oak_leaves_2.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
@ -3827,7 +4018,7 @@ local function register_decorations()
biomes = {"JungleM"},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
schematic = jungle_bush_schematic,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z",
})
minetest.register_decoration({
@ -3845,7 +4036,7 @@ local function register_decorations()
biomes = {"JungleEdge", "JungleEdgeM"},
y_min = 3,
y_max = mcl_vars.mg_overworld_max,
schematic = jungle_bush_schematic,
schematic = mod_mcl_core.."/schematics/mcl_core_jungle_bush_oak_leaves.mts",
flags = "place_center_x, place_center_z",
})
@ -4829,9 +5020,9 @@ local function register_dimension_decorations()
-- Chorus plant
minetest.register_decoration({
name = "mcl_biomes:chorus_plant",
name = "mcl_biomes:chorus",
deco_type = "simple",
place_on = {"mcl_end:end_stone", "air"},
place_on = {"mcl_end:end_stone"},
flags = "all_floors",
sidelen = 16,
noise_params = {
@ -4844,9 +5035,31 @@ local function register_dimension_decorations()
},
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max,
decoration = "mcl_end:chorus_plant",
height = 1,
height_max = 8,
biomes = { "End", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" },
})
minetest.register_decoration({
name = "mcl_biomes:chorus_plant",
deco_type = "simple",
place_on = {"mcl_end:chorus_plant"},
flags = "all_floors",
sidelen = 16,
fill_ratio = 10,
--[[noise_params = {
offset = -0.012,
scale = 0.024,
spread = {x = 100, y = 100, z = 100},
seed = 257,
octaves = 3,
persist = 0.6
},--]]
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max,
decoration = "mcl_end:chorus_flower",
height = 1,
biomes = { "End" },
biomes = { "End", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" },
})
deco_id_chorus_plant = minetest.get_decoration_id("mcl_biomes:chorus_plant")
@ -4933,7 +5146,7 @@ if mg_name ~= "singlenode" then
if minp.y > -26900 then return end
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z
if x < -2 or x > 2 or z < -2 or z > 2 then
if x < -10 or x > 10 or z < -10 or z > 10 then
local realpos = { x = x, y = y + 1, z = z }
local node = minetest.get_node(realpos)
if node and node.name == "mcl_end:chorus_flower" then

View File

@ -1,34 +1,40 @@
local width = 200
local noisemap = PerlinNoiseMap({
offset = 0.5,
scale = 0.5,
spread = {x = 84, y = 84, z = 84},
spread = {x = width + 10, y = width + 10, z = width + 10},
seed = minetest.get_mapgen_setting("seed") + 99999,
octaves = 4,
persist = 0.85,
}, {x = 151, y = 30, z = 151}):get_3d_map({x = 0, y = 0, z = 0})
}, {x = (width*2)+1, y = 30, z = (width * 2) + 1}):get_3d_map({x = 0, y = 0, z = 0})
local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local y_offset = -2
minetest.register_on_generated(function(minp, maxp)
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -75 or minp.x > 75 or maxp.z < -75 or minp.z > 75 then
mcl_mapgen_core.register_generator("end_island", function(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -width or minp.x > width or maxp.z < -width or minp.z > width then
return
end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
for idx in area:iter(math.max(minp.x, -75), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -75), math.min(maxp.x, 75), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, 75)) do
for idx in area:iter(math.max(minp.x, -width), math.max(minp.y, -27025 + y_offset + 4), math.max(minp.z, -width), math.min(maxp.x, width), math.min(maxp.y, -27000 + y_offset), math.min(maxp.z, width)) do
local pos = area:position(idx)
local y = 27025 + pos.y - y_offset
if noisemap[pos.x + 75 + 1][y + 1][pos.z + 75 + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs(pos.x / 75) ^ 2 + math.abs(pos.z / 75) ^ 2) then
if noisemap[pos.x + width + 1][y + 1][pos.z + width + 1] > (math.abs(1 - y / 25) ^ 2 + math.abs(pos.x / width) ^ 2 + math.abs(pos.z / width) ^ 2) then
data[idx] = c_end_stone
end
end
vm:set_data(data)
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end)
return true,false,false
end, function(minp,maxp,blockseed)
if maxp.y < (-27025 + y_offset) or minp.y > (-27000 + y_offset + 4) or maxp.x < -width or minp.x > width or maxp.z < -width or minp.z > width then
return
end
local nn = minetest.find_nodes_in_area_under_air(minp,maxp,{"mcl_end:end_stone"})
local pr = PseudoRandom(blockseed)
table.shuffle(nn)
if nn and #nn > 0 then
for i=1,pr:next(1,math.min(5,#nn)) do
minetest.add_entity(vector.offset(nn[i],0,1,0),"mobs_mc:enderman")
end
end
end, 15, true)

View File

@ -1,4 +1,4 @@
name = mcl_end_island
author = Fleckenstein
depends = mcl_mapgen_core, mcl_end
depends = mcl_mapgen_core, mcl_end, mcl_mobs
description = Generate the end main island for MCL2

View File

@ -0,0 +1,115 @@
local registered_generators = {}
local lvm, nodes, param2 = 0, 0, 0
local lvm_buffer = {}
local logging = minetest.settings:get_bool("mcl_logging_mapgen",false)
local function roundN(n, d)
if type(n) ~= "number" then return n end
local m = 10^d
return math.floor(n * m + 0.5) / m
end
minetest.register_on_generated(function(minp, maxp, blockseed)
local t1 = os.clock()
local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z}
if lvm > 0 then
local lvm_used, shadow, deco_used = false, false, false
local lb2 = {} -- param2
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local e1, e2 = {x=emin.x, y=emin.y, z=emin.z}, {x=emax.x, y=emax.y, z=emax.z}
local data2
local data = vm:get_data(lvm_buffer)
if param2 > 0 then
data2 = vm:get_param2_data(lb2)
end
local area = VoxelArea:new({MinEdge=e1, MaxEdge=e2})
for _, rec in ipairs(registered_generators) do
if rec.vf then
local lvm_used0, shadow0, deco = rec.vf(vm, data, data2, e1, e2, area, p1, p2, blockseed)
if lvm_used0 then
lvm_used = true
end
if shadow0 then
shadow = true
end
if deco then
deco_used = true
end
end
end
if lvm_used then
-- Write stuff
vm:set_data(data)
if param2 > 0 then
vm:set_param2_data(data2)
end
if deco_used then
minetest.generate_decorations(vm)
end
vm:calc_lighting(p1, p2, shadow)
vm:write_to_map()
vm:update_liquids()
end
end
if nodes > 0 then
for _, rec in ipairs(registered_generators) do
if rec.nf then
rec.nf(p1, p2, blockseed)
end
end
end
mcl_vars.add_chunk(minp)
if logging then
minetest.log("action", "[mcl_mapgen_core] Generating chunk " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp).."..."..tostring(roundN(((os.clock() - t1)*1000),2)).."ms")
end
end)
function minetest.register_on_generated(node_function)
mcl_mapgen_core.register_generator("mod_"..minetest.get_current_modname().."_"..tostring(#registered_generators+1), nil, node_function)
end
function mcl_mapgen_core.register_generator(id, lvm_function, node_function, priority, needs_param2)
if not id then return end
local priority = priority or 5000
if lvm_function then lvm = lvm + 1 end
if node_function then nodes = nodes + 1 end
if needs_param2 then param2 = param2 + 1 end
local new_record = {
id = id,
i = priority,
vf = lvm_function,
nf = node_function,
needs_param2 = needs_param2,
}
table.insert(registered_generators, new_record)
table.sort(registered_generators, function(a, b)
return (a.i < b.i) or ((a.i == b.i) and a.vf and (b.vf == nil))
end)
end
function mcl_mapgen_core.unregister_generator(id)
local index
for i, gen in ipairs(registered_generators) do
if gen.id == id then
index = i
break
end
end
if not index then return end
local rec = registered_generators[index]
table.remove(registered_generators, index)
if rec.vf then lvm = lvm - 1 end
if rec.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 1 end
--if rec.needs_level0 then level0 = level0 - 1 end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
name = mcl_mapgen_core
author = Wuzzy
description = The core of the MCL2 mapgen
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures
optional_depends = mclx_core
depends = mcl_init, mcl_core, mcl_deepslate, biomeinfo, mcl_worlds, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures
optional_depends = mclx_core, mcl_copper

View File

@ -0,0 +1,816 @@
local deepslate_max = mcl_worlds.layer_to_y(16)
local deepslate_min = mcl_vars.mg_overworld_min
local copper_mod = minetest.get_modpath("mcl_copper")
local mg_name = minetest.get_mapgen_setting("mg_name")
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
local mountains = {
"ExtremeHills", "ExtremeHills_beach", "ExtremeHills_ocean", "ExtremeHills_deep_ocean", "ExtremeHills_underground",
"ExtremeHills+", "ExtremeHills+_ocean", "ExtremeHills+_deep_ocean", "ExtremeHills+_underground",
"ExtremeHillsM", "ExtremeHillsM_ocean", "ExtremeHillsM_deep_ocean", "ExtremeHillsM_underground",
}
--Clay
minetest.register_ore({
ore_type = "blob",
ore = "mcl_core:clay",
wherein = {"mcl_core:sand","mcl_core:stone","mcl_core:gravel"},
clust_scarcity = 15*15*15,
clust_num_ores = 33,
clust_size = 5,
y_min = -5,
y_max = 0,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 34843,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
-- Diorite, andesite and granite
local specialstones = { "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite" }
for s=1, #specialstones do
local node = specialstones[s]
minetest.register_ore({
ore_type = "blob",
ore = node,
wherein = {"mcl_core:stone"},
clust_scarcity = 15*15*15,
clust_num_ores = 33,
clust_size = 5,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_ore({
ore_type = "blob",
ore = node,
wherein = {"mcl_core:stone"},
clust_scarcity = 10*10*10,
clust_num_ores = 58,
clust_size = 7,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
end
local stonelike = {"mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"}
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "mcl_core:dirt",
wherein = stonelike,
clust_scarcity = 15*15*15,
clust_num_ores = 33,
clust_size = 4,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "mcl_core:gravel",
wherein = stonelike,
clust_scarcity = 14*14*14,
clust_num_ores = 33,
clust_size = 5,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(111),
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_ore({
ore_type = "blob",
ore = "mcl_deepslate:deepslate",
wherein = { "mcl_core:stone" },
clust_scarcity = 200,
clust_num_ores = 100,
clust_size = 10,
y_min = deepslate_min,
y_max = deepslate_max,
noise_params = {
offset = 0,
scale = 1,
spread = { x = 250, y = 250, z = 250 },
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_ore({
ore_type = "blob",
ore = "mcl_deepslate:tuff",
wherein = { "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite", "mcl_deepslate:deepslate" },
clust_scarcity = 10*10*10,
clust_num_ores = 58,
clust_size = 7,
y_min = deepslate_min,
y_max = deepslate_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
-- DEEPSLATE
if minetest.settings:get_bool("mcl_generate_deepslate", true) then
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_deepslate:infested_deepslate",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 26 * 26 * 26,
clust_num_ores = 3,
clust_size = 2,
y_min = deepslate_min,
y_max = deepslate_max,
biomes = mountains,
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:water_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(5),
y_max = deepslate_max,
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 2000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(1),
y_max = mcl_worlds.layer_to_y(10),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = "mcl_deepslate:deepslate",
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(11),
y_max = deepslate_max,
})
end
if minetest.settings:get_bool("mcl_generate_ores", true) then
--
-- Coal
--
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 525*3,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(50),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 510*3,
clust_num_ores = 8,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(50),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 500*3,
clust_num_ores = 12,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(50),
})
-- Medium-rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 550*3,
clust_num_ores = 4,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(51),
y_max = mcl_worlds.layer_to_y(80),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 525*3,
clust_num_ores = 6,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(51),
y_max = mcl_worlds.layer_to_y(80),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 500*3,
clust_num_ores = 8,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(51),
y_max = mcl_worlds.layer_to_y(80),
})
-- Rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 600*3,
clust_num_ores = 3,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(81),
y_max = mcl_worlds.layer_to_y(128),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 550*3,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(81),
y_max = mcl_worlds.layer_to_y(128),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_coal",
wherein = stonelike,
clust_scarcity = 500*3,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(81),
y_max = mcl_worlds.layer_to_y(128),
})
--
-- Iron
--
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_iron",
wherein = stonelike,
clust_scarcity = 830,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(39),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_iron",
wherein = stonelike,
clust_scarcity = 1660,
clust_num_ores = 4,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(40),
y_max = mcl_worlds.layer_to_y(63),
})
--
-- Gold
--
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_gold",
wherein = stonelike,
clust_scarcity = 4775,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(30),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_gold",
wherein = stonelike,
clust_scarcity = 6560,
clust_num_ores = 7,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(30),
})
-- Rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_gold",
wherein = stonelike,
clust_scarcity = 13000,
clust_num_ores = 4,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(31),
y_max = mcl_worlds.layer_to_y(33),
})
--
-- Diamond
--
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_diamond",
wherein = stonelike,
clust_scarcity = 10000,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(12),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_diamond",
wherein = stonelike,
clust_scarcity = 5000,
clust_num_ores = 2,
clust_size = 2,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(12),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_diamond",
wherein = stonelike,
clust_scarcity = 10000,
clust_num_ores = 8,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(12),
})
-- Rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_diamond",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(13),
y_max = mcl_worlds.layer_to_y(15),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_diamond",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 2,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(13),
y_max = mcl_worlds.layer_to_y(15),
})
--
-- Ancient debris
--
local ancient_debris_wherein = {"mcl_nether:netherrack","mcl_blackstone:blackstone","mcl_blackstone:basalt"}
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_nether:ancient_debris",
wherein = ancient_debris_wherein,
clust_scarcity = 25000, -- 0.004% chance
clust_num_ores = 3,
clust_size = 3,
y_min = mcl_vars.mg_nether_min + 8,
y_max = mcl_vars.mg_nether_min + 22,
})
-- Rare spawn (below)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_nether:ancient_debris",
wherein = ancient_debris_wherein,
clust_scarcity = 32000,
clust_num_ores = 2,
clust_size = 3,
y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_nether_min + 8,
})
-- Rare spawn (above)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_nether:ancient_debris",
wherein = ancient_debris_wherein,
clust_scarcity = 32000,
clust_num_ores = 2,
clust_size = 3,
y_min = mcl_vars.mg_nether_min + 22,
y_max = mcl_vars.mg_nether_min + 119,
})
--
-- Redstone
--
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_redstone",
wherein = stonelike,
clust_scarcity = 500,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(13),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_redstone",
wherein = stonelike,
clust_scarcity = 800,
clust_num_ores = 7,
clust_size = 4,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(13),
})
-- Rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_redstone",
wherein = stonelike,
clust_scarcity = 1000,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(13),
y_max = mcl_worlds.layer_to_y(15),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_redstone",
wherein = stonelike,
clust_scarcity = 1600,
clust_num_ores = 7,
clust_size = 4,
y_min = mcl_worlds.layer_to_y(13),
y_max = mcl_worlds.layer_to_y(15),
})
--
-- Emerald
--
if mg_name == "v6" then
-- Generate everywhere in v6, but rarely.
-- Common spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_emerald",
wherein = stonelike,
clust_scarcity = 14340,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(29),
})
-- Rare spawn
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_emerald",
wherein = stonelike,
clust_scarcity = 21510,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(30),
y_max = mcl_worlds.layer_to_y(32),
})
end
--
-- Lapis Lazuli
--
-- Common spawn (in the center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 10000,
clust_num_ores = 7,
clust_size = 4,
y_min = mcl_worlds.layer_to_y(14),
y_max = mcl_worlds.layer_to_y(16),
})
-- Rare spawn (below center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 12000,
clust_num_ores = 6,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(10),
y_max = mcl_worlds.layer_to_y(13),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 14000,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(6),
y_max = mcl_worlds.layer_to_y(9),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 16000,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(2),
y_max = mcl_worlds.layer_to_y(5),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 18000,
clust_num_ores = 3,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(0),
y_max = mcl_worlds.layer_to_y(2),
})
-- Rare spawn (above center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 12000,
clust_num_ores = 6,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(17),
y_max = mcl_worlds.layer_to_y(20),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 14000,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(21),
y_max = mcl_worlds.layer_to_y(24),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 16000,
clust_num_ores = 4,
clust_size = 3,
y_min = mcl_worlds.layer_to_y(25),
y_max = mcl_worlds.layer_to_y(28),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 18000,
clust_num_ores = 3,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(29),
y_max = mcl_worlds.layer_to_y(32),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
wherein = stonelike,
clust_scarcity = 32000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(31),
y_max = mcl_worlds.layer_to_y(32),
})
if minetest.settings:get_bool("mcl_generate_deepslate", true) then
local stonelike = { "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite" }
local function register_ore_mg(ore, scarcity, num, size, y_min, y_max, biomes)
biomes = biomes or ""
minetest.register_ore({
ore_type = "scatter",
ore = ore,
wherein = { "mcl_deepslate:deepslate", "mcl_deepslate:tuff" },
clust_scarcity = scarcity,
clust_num_ores = num,
clust_size = size,
y_min = y_min,
y_max = y_max,
biomes = biomes,
})
end
local ore_mapgen = {
{ "coal", 1575, 5, 3, deepslate_min, deepslate_max },
{ "coal", 1530, 8, 3, deepslate_min, deepslate_max },
{ "coal", 1500, 12, 3, deepslate_min, deepslate_max },
{ "iron", 830, 5, 3, deepslate_min, deepslate_max },
{ "gold", 4775, 5, 3, deepslate_min, deepslate_max },
{ "gold", 6560, 7, 3, deepslate_min, deepslate_max },
{ "diamond", 10000, 4, 3, deepslate_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 5000, 2, 3, deepslate_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 10000, 8, 3, deepslate_min, mcl_worlds.layer_to_y(12) },
{ "diamond", 20000, 1, 1, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "diamond", 20000, 2, 2, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "redstone", 500, 4, 3, deepslate_min, mcl_worlds.layer_to_y(13) },
{ "redstone", 800, 7, 4, deepslate_min, mcl_worlds.layer_to_y(13) },
{ "redstone", 1000, 4, 3, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "redstone", 1600, 7, 4, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "lapis", 10000, 7, 4, mcl_worlds.layer_to_y(14), deepslate_max },
{ "lapis", 12000, 6, 3, mcl_worlds.layer_to_y(10), mcl_worlds.layer_to_y(13) },
{ "lapis", 14000, 5, 3, mcl_worlds.layer_to_y(6), mcl_worlds.layer_to_y(9) },
{ "lapis", 16000, 4, 3, mcl_worlds.layer_to_y(2), mcl_worlds.layer_to_y(5) },
{ "lapis", 18000, 3, 2, mcl_worlds.layer_to_y(0), mcl_worlds.layer_to_y(2) },
}
for _, o in pairs(ore_mapgen) do
register_ore_mg("mcl_deepslate:deepslate_with_"..o[1], o[2], o[3], o[4], o[5], o[6])
end
if minetest.get_mapgen_setting("mg_name") == "v6" then
register_ore_mg("mcl_deepslate:deepslate_with_emerald", 14340, 1, 1, deepslate_min, deepslate_max)
else
register_ore_mg("mcl_deepslate:deepslate_with_emerald", 16384, 1, 1, mcl_worlds.layer_to_y(4), deepslate_max, mountains)
end
if copper_mod then
register_ore_mg("mcl_deepslate:deepslate_with_copper", 830, 5, 3, deepslate_min, deepslate_max)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_copper:stone_with_copper",
wherein = stonelike,
clust_scarcity = 830,
clust_num_ores = 5,
clust_size = 3,
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(39),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_copper:stone_with_copper",
wherein = stonelike,
clust_scarcity = 1660,
clust_num_ores = 4,
clust_size = 2,
y_min = mcl_worlds.layer_to_y(40),
y_max = mcl_worlds.layer_to_y(63),
})
end
end
end
if not superflat then
-- Water and lava springs (single blocks of lava/water source)
-- Water appears at nearly every height, but not near the bottom
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:water_source",
wherein = {"mcl_core:stone", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite", "mcl_core:dirt"},
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(5),
y_max = mcl_worlds.layer_to_y(128),
})
-- Lava springs are rather common at -31 and below
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = stonelike,
clust_scarcity = 2000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(1),
y_max = mcl_worlds.layer_to_y(10),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = stonelike,
clust_scarcity = 9000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(11),
y_max = mcl_worlds.layer_to_y(31),
})
-- Lava springs will become gradually rarer with increasing height
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = stonelike,
clust_scarcity = 32000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(32),
y_max = mcl_worlds.layer_to_y(47),
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = stonelike,
clust_scarcity = 72000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(48),
y_max = mcl_worlds.layer_to_y(61),
})
-- Lava may even appear above surface, but this is very rare
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:lava_source",
wherein = stonelike,
clust_scarcity = 96000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_worlds.layer_to_y(62),
y_max = mcl_worlds.layer_to_y(127),
})
end

View File

@ -0,0 +1,832 @@
local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor
local function register_mgv6_decorations()
-- Cacti
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:sand"},
sidelen = 16,
noise_params = {
offset = -0.012,
scale = 0.024,
spread = {x = 100, y = 100, z = 100},
seed = 257,
octaves = 3,
persist = 0.6
},
y_min = 4,
y_max = mcl_vars.mg_overworld_max,
decoration = "mcl_core:cactus",
height = 1,
height_max = 3,
})
-- Sugar canes
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
sidelen = 16,
noise_params = {
offset = -0.3,
scale = 0.7,
spread = {x = 100, y = 100, z = 100},
seed = 465,
octaves = 3,
persist = 0.7
},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
decoration = "mcl_core:reeds",
height = 1,
height_max = 3,
spawn_by = { "mcl_core:water_source", "group:frosted_ice" },
num_spawn_by = 1,
})
-- Doubletall grass
minetest.register_decoration({
deco_type = "schematic",
schematic = {
size = { x=1, y=3, z=1 },
data = {
{ name = "air", prob = 0 },
{ name = "mcl_flowers:double_grass", param1 = 255, },
{ name = "mcl_flowers:double_grass_top", param1 = 255, },
},
},
place_on = {"group:grass_block_no_snow"},
sidelen = 8,
noise_params = {
offset = -0.0025,
scale = 0.03,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.0,
},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
})
-- Large ferns
minetest.register_decoration({
deco_type = "schematic",
schematic = {
size = { x=1, y=3, z=1 },
data = {
{ name = "air", prob = 0 },
{ name = "mcl_flowers:double_fern", param1=255, },
{ name = "mcl_flowers:double_fern_top", param1=255, },
},
},
-- v6 hack: This makes sure large ferns only appear in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
num_spawn_by = 1,
place_on = {"group:grass_block_no_snow"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.01,
spread = {x = 250, y = 250, z = 250},
seed = 333,
octaves = 2,
persist = 0.66,
},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
})
-- Large flowers
local function register_large_flower(name, seed, offset)
minetest.register_decoration({
deco_type = "schematic",
schematic = {
size = { x=1, y=3, z=1 },
data = {
{ name = "air", prob = 0 },
{ name = "mcl_flowers:"..name, param1=255, },
{ name = "mcl_flowers:"..name.."_top", param1=255, },
},
},
place_on = {"group:grass_block_no_snow"},
sidelen = 16,
noise_params = {
offset = offset,
scale = 0.01,
spread = {x = 300, y = 300, z = 300},
seed = seed,
octaves = 5,
persist = 0.62,
},
y_min = 1,
y_max = mcl_vars.overworld_max,
flags = "",
})
end
register_large_flower("rose_bush", 9350, -0.008)
register_large_flower("peony", 10450, -0.008)
register_large_flower("lilac", 10600, -0.007)
register_large_flower("sunflower", 2940, -0.005)
-- Lily pad
minetest.register_decoration({
deco_type = "schematic",
schematic = {
size = { x=1, y=3, z=1 },
data = {
{ name = "mcl_core:water_source", prob = 0 },
{ name = "mcl_core:water_source" },
{ name = "mcl_flowers:waterlily", param1 = 255 },
},
},
place_on = "mcl_core:dirt",
sidelen = 16,
noise_params = {
offset = -0.12,
scale = 0.3,
spread = {x = 200, y = 200, z = 200},
seed = 503,
octaves = 6,
persist = 0.7,
},
y_min = 0,
y_max = 0,
rotation = "random",
})
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_farming:pumpkin",
param2 = 0,
param2_max = 3,
place_on = {"group:grass_block_no_snow"},
sidelen = 16,
noise_params = {
offset = -0.008,
scale = 0.00666,
spread = {x = 250, y = 250, z = 250},
seed = 666,
octaves = 6,
persist = 0.666
},
y_min = 1,
y_max = mcl_vars.overworld_max,
})
-- Melon
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
sidelen = 16,
noise_params = {
offset = 0.002,
scale = 0.006,
spread = {x = 250, y = 250, z = 250},
seed = 333,
octaves = 3,
persist = 0.6
},
-- Small trick to make sure melon spawn in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
num_spawn_by = 1,
y_min = 1,
y_max = 40,
decoration = "mcl_farming:melon",
})
-- Tall grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
sidelen = 8,
noise_params = {
offset = 0.01,
scale = 0.3,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
sidelen = 8,
noise_params = {
offset = 0.04,
scale = 0.03,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
-- Seagrass and kelp
local materials = {"dirt","sand"}
for i=1, #materials do
local mat = materials[i]
minetest.register_decoration({
deco_type = "simple",
spawn_by = {"group:water"},
num_spawn_by = 1,
place_on = {"mcl_core:"..mat},
sidelen = 8,
noise_params = {
offset = 0.04,
scale = 0.3,
spread = {x = 100, y = 100, z = 100},
seed = 421,
octaves = 3,
persist = 0.6
},
flags = "force_placement",
place_offset_y = -1,
y_min = mcl_vars.overworld_min,
y_max = 0,
decoration = "mcl_ocean:seagrass_"..mat,
})
minetest.register_decoration({
deco_type = "simple",
spawn_by = {"group:water"},
num_spawn_by = 1,
place_on = {"mcl_core:mat"},
sidelen = 8,
noise_params = {
offset = 0.08,
scale = 0.03,
spread = {x = 100, y = 100, z = 100},
seed = 421,
octaves = 3,
persist = 0.6
},
flags = "force_placement",
place_offset_y = -1,
y_min = mcl_vars.overworld_min,
y_max = -5,
decoration = "mcl_ocean:seagrass_"..mat,
})
minetest.register_decoration({
deco_type = "simple",
spawn_by = {"group:water"},
num_spawn_by = 1,
place_on = {"mcl_core:"..mat},
sidelen = 16,
noise_params = {
offset = 0.01,
scale = 0.01,
spread = {x = 300, y = 300, z = 300},
seed = 505,
octaves = 5,
persist = 0.62,
},
flags = "force_placement",
place_offset_y = -1,
y_min = mcl_vars.overworld_min,
y_max = -6,
decoration = "mcl_ocean:kelp_"..mat,
param2 = 16,
param2_max = 96,
})
minetest.register_decoration({
deco_type = "simple",
spawn_by = {"group:water"},
num_spawn_by = 1,
place_on = {"mcl_core:"..mat},
sidelen = 16,
noise_params = {
offset = 0.01,
scale = 0.01,
spread = {x = 100, y = 100, z = 100},
seed = 506,
octaves = 5,
persist = 0.62,
},
flags = "force_placement",
place_offset_y = -1,
y_min = mcl_vars.overworld_min,
y_max = -15,
decoration = "mcl_ocean:kelp_"..mat,
param2 = 32,
param2_max = 160,
})
end
-- Wet Sponge
-- TODO: Remove this when we got ocean monuments
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_sponges:sponge_wet",
spawn_by = {"group:water"},
num_spawn_by = 1,
place_on = {"mcl_core:dirt","mcl_core:sand"},
sidelen = 16,
noise_params = {
offset = 0.00295,
scale = 0.006,
spread = {x = 250, y = 250, z = 250},
seed = 999,
octaves = 3,
persist = 0.666
},
flags = "force_placement",
y_min = mcl_vars.mg_lava_overworld_max + 5,
y_max = -20,
})
-- Add a small amount of tall grass everywhere to avoid areas completely empty devoid of tall grass
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
sidelen = 8,
fill_ratio = 0.004,
y_min = 1,
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"}
local mseeds = { 7133, 8244 }
for m=1, #mushrooms do
-- Mushrooms next to trees
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt", "mcl_core:podzol", "mcl_core:mycelium", "mcl_core:stone", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite"},
sidelen = 16,
noise_params = {
offset = 0.04,
scale = 0.04,
spread = {x = 100, y = 100, z = 100},
seed = mseeds[m],
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
decoration = mushrooms[m],
spawn_by = { "mcl_core:tree", "mcl_core:sprucetree", "mcl_core:darktree", "mcl_core:birchtree", },
num_spawn_by = 1,
})
end
-- Dead bushes
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:sand", "mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt", "group:hardened_clay"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.035,
spread = {x = 100, y = 100, z = 100},
seed = 1972,
octaves = 3,
persist = 0.6
},
y_min = 4,
y_max = mcl_vars.mg_overworld_max,
decoration = "mcl_core:deadbush",
})
local function register_mgv6_flower(name, seed, offset, y_max)
if offset == nil then
offset = 0
end
if y_max == nil then
y_max = mcl_vars.mg_overworld_max
end
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
sidelen = 16,
noise_params = {
offset = offset,
scale = 0.006,
spread = {x = 100, y = 100, z = 100},
seed = seed,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = y_max,
decoration = "mcl_flowers:"..name,
})
end
register_mgv6_flower("tulip_red", 436)
register_mgv6_flower("tulip_orange", 536)
register_mgv6_flower("tulip_pink", 636)
register_mgv6_flower("tulip_white", 736)
register_mgv6_flower("azure_bluet", 800)
register_mgv6_flower("dandelion", 8)
-- Allium is supposed to only appear in flower forest in MC. There are no flower forests in v6.
-- We compensate by making it slightly rarer in v6.
register_mgv6_flower("allium", 0, -0.001)
--[[ Blue orchid is supposed to appear in swamplands. There are no swamplands in v6.
We emulate swamplands by limiting the height to 5 levels above sea level,
which should be close to the water. ]]
register_mgv6_flower("blue_orchid", 64500, nil, mcl_worlds.layer_to_y(67))
register_mgv6_flower("oxeye_daisy", 3490)
register_mgv6_flower("poppy", 9439)
-- Put top snow on snowy grass blocks. The v6 mapgen does not generate the top snow on its own.
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_snow"},
sidelen = 16,
fill_ratio = 11.0, -- complete coverage
y_min = 1,
y_max = mcl_vars.mg_overworld_max,
decoration = "mcl_core:snow",
})
end
register_mgv6_decorations()
local function generate_mgv6_structures()
local chunk_has_igloo = false
local struct_min, struct_max = -3, 111 --64
--except end exit portall all v6
if maxp.y >= struct_min and minp.y <= struct_max then
-- Generate structures
local pr = PcgRandom(blockseed)
perlin_structures = perlin_structures or minetest.get_perlin(329, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 5
for x0 = minp.x, maxp.x, divlen do for z0 = minp.z, maxp.z, divlen do
-- Determine amount from perlin noise
local amount = math.floor(perlin_structures:get_2d({x=x0, y=z0}) * 9)
-- Find random positions based on this random
local p, ground_y
for i=0, amount do
p = {x = pr:next(x0, x0+divlen-1), y = 0, z = pr:next(z0, z0+divlen-1)}
-- Find ground level
ground_y = nil
local nn
for y = struct_max, struct_min, -1 do
p.y = y
local checknode = minetest.get_node(p)
if checknode then
nn = checknode.name
local def = minetest.registered_nodes[nn]
if def and def.walkable then
ground_y = y
break
end
end
end
if ground_y then
p.y = ground_y+1
local nn0 = minetest.get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn0] and minetest.registered_nodes[nn0].buildable_to then
-- Igloos
if not chunk_has_igloo and (nn == "mcl_core:snowblock" or nn == "mcl_core:snow" or (minetest.get_item_group(nn, "grass_block_snow") == 1)) then
if pr:next(1, 4400) == 1 then
-- Check surface
local floor = {x=p.x+9, y=p.y-1, z=p.z+9}
local surface = minetest.find_nodes_in_area({x=p.x,y=p.y-1,z=p.z}, floor, "mcl_core:snowblock")
local surface2 = minetest.find_nodes_in_area({x=p.x,y=p.y-1,z=p.z}, floor, "mcl_core:dirt_with_grass_snow")
if #surface + #surface2 >= 63 then
mcl_structures.call_struct(p, "igloo", nil, pr)
chunk_has_igloo = true
end
end
end
-- Fossil
if nn == "mcl_core:sandstone" or nn == "mcl_core:sand" and not chunk_has_desert_temple and ground_y > 3 then
local fossil_prob = minecraft_chunk_probability(64, minp, maxp)
if pr:next(1, fossil_prob) == 1 then
-- Spawn fossil below desert surface between layers 40 and 49
local p1 = {x=p.x, y=pr:next(mcl_worlds.layer_to_y(40), mcl_worlds.layer_to_y(49)), z=p.z}
-- Very rough check of the environment (we expect to have enough stonelike nodes).
-- Fossils may still appear partially exposed in caves, but this is O.K.
local p2 = vector.add(p1, 4)
local nodes = minetest.find_nodes_in_area(p1, p2, {"mcl_core:sandstone", "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite", "mcl_core:stone_with_coal", "mcl_core:dirt", "mcl_core:gravel"})
if #nodes >= 100 then -- >= 80%
mcl_structures.call_struct(p1, "fossil", nil, pr)
end
end
end
-- Witch hut (v6)
if ground_y <= 0 and nn == "mcl_core:dirt" then
local prob = minecraft_chunk_probability(48, minp, maxp)
if pr:next(1, prob) == 1 then
local swampland = minetest.get_biome_id("Swampland")
local swampland_shore = minetest.get_biome_id("Swampland_shore")
-- Where do witches live?
-- v6: In Normal biome
if biomeinfo.get_v6_biome(p) == "Normal" then
here_be_witches = true
end
local here_be_witches = false
if here_be_witches then
local r = tostring(pr:next(0, 3) * 90) -- "0", "90", "180" or 270"
local p1 = {x=p.x-1, y=WITCH_HUT_HEIGHT+2, z=p.z-1}
local size
if r == "0" or r == "180" then
size = {x=10, y=4, z=8}
else
size = {x=8, y=4, z=10}
end
local p2 = vector.add(p1, size)
-- This checks free space at the “body” of the hut and a bit around.
-- ALL nodes must be free for the placement to succeed.
local free_nodes = minetest.find_nodes_in_area(p1, p2, {"air", "mcl_core:water_source", "mcl_flowers:waterlily"})
if #free_nodes >= ((size.x+1)*(size.y+1)*(size.z+1)) then
local place = {x=p.x, y=WITCH_HUT_HEIGHT-1, z=p.z}
-- FIXME: For some mysterious reason (black magic?) this
-- function does sometimes NOT spawn the witch hut. One can only see the
-- oak wood nodes in the water, but no hut. :-/
mcl_structures.place_structure(place,mcl_structures.registered_structures["witch_hut"],pr)
local function place_tree_if_free(pos, prev_result)
local nn = minetest.get_node(pos).name
if nn == "mcl_flowers:waterlily" or nn == "mcl_core:water_source" or nn == "mcl_core:water_flowing" or nn == "air" then
minetest.set_node(pos, {name="mcl_core:tree", param2=0})
return prev_result
else
return false
end
end
local offsets
if r == "0" then
offsets = {
{x=1, y=0, z=1},
{x=1, y=0, z=5},
{x=6, y=0, z=1},
{x=6, y=0, z=5},
}
elseif r == "180" then
offsets = {
{x=2, y=0, z=1},
{x=2, y=0, z=5},
{x=7, y=0, z=1},
{x=7, y=0, z=5},
}
elseif r == "270" then
offsets = {
{x=1, y=0, z=1},
{x=5, y=0, z=1},
{x=1, y=0, z=6},
{x=5, y=0, z=6},
}
elseif r == "90" then
offsets = {
{x=1, y=0, z=2},
{x=5, y=0, z=2},
{x=1, y=0, z=7},
{x=5, y=0, z=7},
}
end
for o=1, #offsets do
local ok = true
for y=place.y-1, place.y-64, -1 do
local tpos = vector.add(place, offsets[o])
tpos.y = y
ok = place_tree_if_free(tpos, ok)
if not ok then
break
end
end
end
end
end
end
end
-- Ice spikes in v6
-- In other mapgens, ice spikes are generated as decorations.
if nn == "mcl_core:snowblock" then
local spike = pr:next(1,58000)
if spike < 3 then
-- Check surface
local floor = {x=p.x+4, y=p.y-1, z=p.z+4}
local surface = minetest.find_nodes_in_area({x=p.x+1,y=p.y-1,z=p.z+1}, floor, {"mcl_core:snowblock"})
-- Check for collision with spruce
local spruce_collisions = minetest.find_nodes_in_area({x=p.x+1,y=p.y+2,z=p.z+1}, {x=p.x+4, y=p.y+6, z=p.z+4}, {"mcl_core:sprucetree", "mcl_core:spruceleaves"})
if #surface >= 9 and #spruce_collisions == 0 then
mcl_structures.place_structure(p,mcl_structures.registered_structures["ice_spike_large"],pr)
end
elseif spike < 100 then
-- Check surface
local floor = {x=p.x+6, y=p.y-1, z=p.z+6}
local surface = minetest.find_nodes_in_area({x=p.x+1,y=p.y-1,z=p.z+1}, floor, {"mcl_core:snowblock", "mcl_core:dirt_with_grass_snow"})
-- Check for collision with spruce
local spruce_collisions = minetest.find_nodes_in_area({x=p.x+1,y=p.y+1,z=p.z+1}, {x=p.x+6, y=p.y+6, z=p.z+6}, {"mcl_core:sprucetree", "mcl_core:spruceleaves"})
if #surface >= 25 and #spruce_collisions == 0 then
mcl_structures.place_structure(p,mcl_structures.registered_structures["ice_spike_small"],pr)
end
end
end
end
end
end
end end
end
end
-- Generate mushrooms in caves manually.
-- only v6. minetest supports cave decos via "all_floors" flag now
local function generate_underground_mushrooms(minp, maxp, seed)
local pr_shroom = PseudoRandom(seed-24359)
-- Generate rare underground mushrooms
-- TODO: Make them appear in groups, use Perlin noise
local min, max = mcl_vars.mg_lava_overworld_max + 4, 0
if minp.y > max or maxp.y < min then
return
end
local bpos
local stone = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_core:stone", "mcl_core:dirt", "mcl_core:mycelium", "mcl_core:podzol", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite", "mcl_core:stone_with_coal", "mcl_core:stone_with_iron", "mcl_core:stone_with_gold"})
for n = 1, #stone do
bpos = {x = stone[n].x, y = stone[n].y + 1, z = stone[n].z }
local l = minetest.get_node_light(bpos, 0.5)
if bpos.y >= min and bpos.y <= max and l and l <= 12 and pr_shroom:next(1,1000) < 4 then
if pr_shroom:next(1,2) == 1 then
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"})
else
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"})
end
end
end
end
-- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart
-- (only v6)
local nether_wart_chance = 85
local function generate_nether_decorations(minp, maxp, seed)
local pr_nether = PseudoRandom(seed+667)
if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then
return
end
minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
-- TODO: Generate everything based on Perlin noise instead of PseudoRandom
local bpos
local rack = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:netherrack"})
local magma = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:magma"})
local ssand = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:soul_sand"})
-- Helper function to spawn “fake” decoration
local function special_deco(nodes, spawn_func)
for n = 1, #nodes do
bpos = {x = nodes[n].x, y = nodes[n].y + 1, z = nodes[n].z }
spawn_func(bpos)
end
end
-- Eternal fire on netherrack
special_deco(rack, function(bpos)
-- Eternal fire on netherrack
if pr_nether:next(1,100) <= 3 then
minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"})
end
end)
-- Eternal fire on magma cubes
special_deco(magma, function(bpos)
if pr_nether:next(1,150) == 1 then
minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"})
end
end)
-- Mushrooms on netherrack
-- Note: Spawned *after* the fire because of light level checks
special_deco(rack, function(bpos)
local l = minetest.get_node_light(bpos, 0.5)
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
-- TODO: Make mushrooms appear in groups, use Perlin noise
if pr_nether:next(1,2) == 1 then
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"})
else
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"})
end
end
end)
-- Nether wart on soul sand
-- TODO: Spawn in Nether fortresses
special_deco(ssand, function(bpos)
if pr_nether:next(1, nether_wart_chance) == 1 then
minetest.set_node(bpos, {name = "mcl_nether:nether_wart"})
end
end)
end
local function remove_mgv6_broken_plants(minp,maxp)
--[[ Remove broken double plants caused by v6 weirdness.
v6 might break the bottom part of double plants because of how it works.
There are 3 possibilities:
1) Jungle: Top part is placed on top of a jungle tree or fern (=v6 jungle grass).
This is because the schematic might be placed even if some nodes of it
could not be placed because the destination was already occupied.
TODO: A better fix for this would be if schematics could abort placement
altogether if ANY of their nodes could not be placed.
2) Cavegen: Removes the bottom part, the upper part floats
3) Mudflow: Same as 2) ]]
local plants = minetest.find_nodes_in_area(minp, maxp, "group:double_plant")
for n = 1, #plants do
local node = vm:get_node_at(plants[n])
local is_top = minetest.get_item_group(node.name, "double_plant") == 2
if is_top then
local p_pos = area:index(plants[n].x, plants[n].y-1, plants[n].z)
if p_pos then
node = vm:get_node_at({x=plants[n].x, y=plants[n].y-1, z=plants[n].z})
local is_bottom = minetest.get_item_group(node.name, "double_plant") == 1
if not is_bottom then
p_pos = area:index(plants[n].x, plants[n].y, plants[n].z)
data[p_pos] = c_air
lvm_used = true
end
end
end
end
end
local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
if not (minp.y <= mcl_vars.mg_nether_max and maxp.y >= mcl_vars.mg_nether_min) then
return
end
-- Nether block fixes:
-- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6.
local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"})
for _, n in pairs(nodes) do
data[area:index(n.x, n.y, n.z)] = c_nether_lava
lvm_used = true
end
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then
data[p_pos] = c_nether_lava
lvm_used = true
elseif data[p_pos] == c_stone then
data[p_pos] = c_netherrack
lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then
data[p_pos] = c_soul_sand
lvm_used = true
end
end
end
local function end_fixes(minp,maxp)
if not ( minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min ) then
return
end
local nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
if #nodes > 0 then
lvm_used = true
for _,n in pairs(nodes) do
data[area:index(n.x, n.y, n.z)] = c_air
end
end
end
local function basic_node(minp, maxp, blockseed)
if mg_name ~= "singlenode" then
-- Generate special decorations
if mg_name == "v6" then
generate_underground_mushrooms(minp, maxp, blockseed)
generate_nether_decorations(minp, maxp, blockseed)
end_fixes(minp,maxp)
remove_mgv6_broken_plants(minp,maxp,blockseed)
generate_mgv6_structures(minp, maxp, blockseed, minetest.get_mapgen_object("biomemap"))
end
end
end
mcl_mapgen_core.register_generator("mgv6-fixes", basic, basic_node, 10, true)

View File

@ -4,8 +4,10 @@ local disabled_structures = minetest.settings:get("mcl_disabled_structures")
if disabled_structures then disabled_structures = disabled_structures:split(",")
else disabled_structures = {} end
local logging = minetest.settings:get_bool("mcl_logging_structures",true)
function mcl_structures.is_disabled(structname)
if table.indexof(disabled_structures,structname) ~= -1 then return true end
return table.indexof(disabled_structures,structname) ~= -1
end
function mcl_structures.fill_chests(p1,p2,loot,pr)
@ -22,12 +24,19 @@ function mcl_structures.fill_chests(p1,p2,loot,pr)
end
local function generate_loot(pos, def, pr)
local hl = def.sidelen / 2
local hl = def.sidelen
local p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = vector.offset(pos,hl,hl,hl)
if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end
end
local function construct_nodes(pos,def,pr)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,0,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2),def.construct_nodes)
for _,p in pairs(nn) do
mcl_structures.init_node_construct(p)
end
end
function mcl_structures.find_lowest_y(pp)
local y = 31000
@ -129,7 +138,7 @@ end
function mcl_structures.place_structure(pos, def, pr, blockseed)
if not def then return end
local logging = not def.terrain_feature
local log_enabled = logging and not def.terrain_feature
local y_offset = 0
if type(def.y_offset) == "function" then
y_offset = def.y_offset(pr)
@ -146,7 +155,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed)
if def.make_foundation then
foundation(vector.offset(pos,-def.sidelen/2 - 3,-1,-def.sidelen/2 - 3),vector.offset(pos,def.sidelen/2 + 3,-1,def.sidelen/2 + 3),pos,def.sidelen)
else
if logging then
if log_enabled then
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.")
end
return false
@ -154,7 +163,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed)
end
end
if def.on_place and not def.on_place(pos,def,pr,blockseed) then
if logging then
if log_enabled then
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. Conditions not satisfied.")
end
return false
@ -168,23 +177,26 @@ function mcl_structures.place_structure(pos, def, pr, blockseed)
if def.after_place then ap = def.after_place end
mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",function(p)
if def.loot then generate_loot(pos,def,pr,blockseed) end
return ap(pos,def,pr,blockseed)
if def.loot then generate_loot(pp,def,pr,blockseed) end
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
return ap(pp,def,pr,blockseed)
end,pr)
if logging then
if log_enabled then
minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp))
end
return true
end
elseif def.place_func and def.place_func(pos,def,pr,blockseed) then
if not def.after_place or ( def.after_place and def.after_place(pos,def,pr,blockseed) ) then
if logging then
elseif def.place_func and def.place_func(pp,def,pr,blockseed) then
if not def.after_place or ( def.after_place and def.after_place(pp,def,pr,blockseed) ) then
if def.loot then generate_loot(pp,def,pr,blockseed) end
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
if log_enabled then
minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp))
end
return true
end
end
if logging then
if log_enabled then
minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos))
end
end
@ -201,28 +213,31 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
sbgroups.structblock = nil
sbgroups.structblock_lbm = 1
else
minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered
def.deco = minetest.register_decoration({
name = "mcl_structures:deco_"..name,
decoration = structblock,
deco_type = "simple",
place_on = def.place_on,
spawn_by = def.spawn_by,
num_spawn_by = def.num_spawn_by,
sidelen = 80,
fill_ratio = def.fill_ratio,
noise_params = def.noise_params,
flags = flags,
biomes = def.biomes,
y_max = def.y_max,
y_min = def.y_min
})
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups})
def.structblock = structblock
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name)
minetest.set_gen_notify({decoration=true}, { def.deco_id })
--catching of gennotify happens in mcl_mapgen_core
end)
if def.place_on then
minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered
def.deco = minetest.register_decoration({
name = "mcl_structures:deco_"..name,
decoration = structblock,
deco_type = "simple",
place_on = def.place_on,
spawn_by = def.spawn_by,
num_spawn_by = def.num_spawn_by,
sidelen = 80,
fill_ratio = def.fill_ratio,
noise_params = def.noise_params,
flags = flags,
biomes = def.biomes,
y_max = def.y_max,
y_min = def.y_min
})
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,})
def.structblock = structblock
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name)
minetest.set_gen_notify({decoration=true}, { def.deco_id })
--catching of gennotify happens in mcl_mapgen_core
end)
end
end
mcl_structures.registered_structures[name] = def
end

View File

@ -0,0 +1,135 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
local function spawn_shulkers(pos,def,pr)
local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2),{"mcl_end:purpur_block"})
if nn and #nn > 0 then
table.shuffle(nn)
for i = 1,pr:next(1,math.min(6,#nn)) do
minetest.add_entity(vector.offset(nn[i],0,0.5,0),"mobs_mc:shulker")
end
end
local guard = minetest.find_node_near(pos,def.sidelen,{"mcl_itemframes:item_frame"})
if guard then
minetest.add_entity(vector.offset(guard,0,-1.5,0),"mobs_mc:shulker")
end
end
mcl_structures.register_structure("end_shipwreck",{
place_on = {"mcl_end:end_stone"},
fill_ratio = 0.001,
flags = "place_center_x, place_center_z, all_floors",
y_offset = function(pr) return pr:next(-50,-20) end,
chunk_probability = 800,
--y_max = mcl_vars.mg_end_max,
--y_min = mcl_vars.mg_end_min -100,
biomes = { "End", "EndHighlands", "EndMidlands", "EndBarrens", "EndSmallIslands" },
sidelen = 32,
filenames = {
modpath.."/schematics/mcl_structures_end_shipwreck_1.mts",
},
construct_nodes = {"mcl_chests:ender_chest_small","mcl_chests:ender_chest","mcl_brewing:stand_000","mcl_chests:violet_shulker_box_small"},
after_place = function(pos,def,pr)
local fr = minetest.find_node_near(pos,def.sidelen,{"mcl_itemframes:item_frame"})
if fr then
if mcl_itemframes then
mcl_itemframes.update_item_entity(fr,minetest.get_node(fr))
end
end
return spawn_shulkers(pos,def,pr)
end,
loot = {
[ "mcl_itemframes:item_frame" ] ={{
stacks_min = 1,
stacks_max = 1,
items = {
{ itemstring = "mcl_armor:elytra", weight = 100 },
},
}},
[ "mcl_chests:chest_small" ] ={{
stacks_min = 2,
stacks_max = 6,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 16, amount_min = 1, amount_max=10 },
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },
--{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO
{ itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 4, amount_max = 8 },
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:sword_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:chestplate_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, },
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
}
}}
}
})
mcl_structures.register_structure("end_boat",{
place_on = {"mcl_end:end_stone"},
fill_ratio = 0.01,
flags = "place_center_x, place_center_z, all_floors",
y_offset = function(pr) return pr:next(15,30) end,
chunk_probability = 900,
--y_max = mcl_vars.mg_end_max,
--y_min = mcl_vars.mg_end_min -100,
biomes = { "End", "EndHighlands", "EndMidlands", "EndBarrens", "EndSmallIslands" },
sidelen = 20,
filenames = {
modpath.."/schematics/mcl_structures_end_boat.mts",
},
after_place = spawn_shulkers,
construct_nodes = {"mcl_chests:ender_chest_small","mcl_chests:ender_chest","mcl_brewing:stand_000","mcl_chests:violet_shulker_box_small"},
loot = {
[ "mcl_chests:chest_small" ] ={{
stacks_min = 2,
stacks_max = 6,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 16, amount_min = 1, amount_max=10 },
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },
{ itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 4, amount_max = 8 },
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, },
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
}
}}
}
})

View File

@ -0,0 +1,123 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("end_spawn_obsidian_platform",{
static_pos ={mcl_vars.mg_end_platform_pos},
place_func = function(pos,def,pr)
local obby = minetest.find_nodes_in_area(vector.offset(pos,-2,0,-2),vector.offset(pos,2,0,2),{"air","mcl_end:end_stone"})
local air = minetest.find_nodes_in_area(vector.offset(pos,-2,1,-2),vector.offset(pos,2,3,2),{"air","mcl_end:end_stone"})
minetest.bulk_set_node(obby,{name="mcl_core:obsidian"})
minetest.bulk_set_node(air,{name="air"})
return true
end,
})
mcl_structures.register_structure("end_exit_portal",{
static_pos = { mcl_vars.mg_end_exit_portal_pos },
filenames = {
modpath.."/schematics/mcl_structures_end_exit_portal.mts"
},
after_place = function(pos,def,pr,blockseed)
if minetest.settings:get_bool("only_peaceful_mobs", false) then
return
end
local p1 = vector.offset(pos,-16,-16,-16)
local p2 = vector.offset(pos,16,21,16)
minetest.emerge_area(p1,p2,function(blockpos, action, calls_remaining, param)
if calls_remaining > 0 then return end
minetest.bulk_set_node(minetest.find_nodes_in_area(p1,p2,{"mcl_portals:portal_end"}),{name="air"})
local obj = minetest.add_entity(vector.offset(pos,3, 11, 3), "mobs_mc:enderdragon")
if obj then
local dragon_entity = obj:get_luaentity()
dragon_entity._portal_pos = pos
if blockseed ~= -1 then
dragon_entity._initial = true
end
else
minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn")
end
minetest.fix_light(p1,p2)
end)
end
})
mcl_structures.register_structure("end_exit_portal_open",{
filenames = {
modpath.."/schematics/mcl_structures_end_exit_portal.mts"
},
after_place = function(pos,def,pr)
local p1 = vector.offset(pos,-16,-16,-16)
local p2 = vector.offset(pos,16,16,16)
minetest.fix_light(p1,p2)
end
})
mcl_structures.register_structure("end_gateway_portal",{
filenames = {
modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
},
})
local function get_tower(p,h,tbl)
for i = 1,h do
table.insert(tbl,vector.offset(p,0,i,0))
end
end
local function make_endspike(pos,width,height)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-width/2,0,-width/2),vector.offset(pos,width/2,0,width/2),{"air","group:solid"})
table.sort(nn,function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
local nodes = {}
for i = 1,math.ceil(#nn*0.55) do
get_tower(nn[i],height,nodes)
end
minetest.bulk_set_node(nodes,{ name="mcl_core:obsidian"} )
return vector.offset(pos,0,height,0)
end
function make_cage(pos,width)
local nodes = {}
local nodes2 = {}
local r = math.max(1,math.floor(width/2) - 2)
for x=-r,r do for y = 0,width do for z = -r,r do
if x == r or x == -r or z==r or z == -r then
table.insert(nodes,vector.add(pos,vector.new(x,y,z)))
end
end end end
if xpanes then
minetest.bulk_set_node(nodes,{ name="xpanes:bar_flat"} )
for _,p in pairs(nodes) do
xpanes.update_pane(p)
end
end
end
local function get_points_on_circle(pos,r,n)
local rt = {}
for i=1, n do
table.insert(rt,vector.offset(pos,r * math.cos(((i-1)/n) * (2*math.pi)),0, r* math.sin(((i-1)/n) * (2*math.pi)) ))
end
return rt
end
mcl_structures.register_structure("end_spike",{
static_pos =get_points_on_circle(vector.offset(mcl_vars.mg_end_exit_portal_pos,0,-20,0),43,10),
place_func = function(pos,def,pr)
local d = pr:next(6,12)
local h = d * pr:next(4,6)
local p1 = vector.add(pos,-d/2,0,-d/2)
local p2 = vector.add(pos,d/2,h+d,d/2)
minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
if calls_remaining ~= 0 then return end
local s = make_endspike(pos,d,h)
minetest.set_node(vector.offset(s,0,1,0),{name="mcl_core:bedrock"})
minetest.add_entity(vector.offset(s,0,2,0),"mcl_end:crystal")
if pr:next(1,3) == 1 then
make_cage(vector.offset(s,0,1,0),d)
end
end)
return true
end,
})

View File

@ -81,33 +81,11 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr)
if not rotation then
rotation = "random"
end
if struct_style == "end_exit_portal" then
return mcl_structures.generate_end_exit_portal(pos, rotation)
elseif struct_style == "end_exit_portal_open" then
return mcl_structures.generate_end_exit_portal_open(pos, rotation)
elseif struct_style == "end_gateway_portal" then
return mcl_structures.generate_end_gateway_portal(pos, rotation)
elseif struct_style == "end_portal_shrine" then
if struct_style == "end_portal_shrine" then
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
end
end
function mcl_structures.generate_end_exit_portal(pos, rot)
local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", {["mcl_portals:portal_end"] = "air"}, true)
end
function mcl_structures.generate_end_exit_portal_open(pos, rot)
local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
end
function mcl_structures.generate_end_gateway_portal(pos, rot)
local path = modpath.."/schematics/mcl_structures_end_gateway_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
end
local function shrine_placement_callback(p1, p2, size, rotation, pr)
-- Find and setup spawner with silverfish
local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner")
@ -247,6 +225,8 @@ dofile(modpath.."/woodland_mansion.lua")
dofile(modpath.."/ruined_portal.lua")
dofile(modpath.."/geode.lua")
dofile(modpath.."/pillager_outpost.lua")
dofile(modpath.."/end_spawn.lua")
dofile(modpath.."/end_city.lua")
mcl_structures.register_structure("desert_well",{
@ -310,7 +290,7 @@ mcl_structures.register_structure("ice_spike_large",{
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon",
params = "end_portal_shrine | dungeon",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
@ -324,18 +304,10 @@ minetest.register_chatcommand("spawnstruct", {
local pr = PseudoRandom(pos.x+pos.y+pos.z)
local errord = false
local message = S("Structure placed.")
if param == "end_exit_portal" then
mcl_structures.generate_end_exit_portal(pos, rot, pr)
elseif param == "end_exit_portal_open" then
mcl_structures.generate_end_exit_portal_open(pos, rot, pr)
elseif param == "end_gateway_portal" then
mcl_structures.generate_end_gateway_portal(pos, rot, pr)
elseif param == "end_portal_shrine" then
if param == "end_portal_shrine" then
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
mcl_dungeons.spawn_dungeon(pos, rot, pr)
elseif param == "nether_portal" and mcl_portals and mcl_portals.spawn_nether_portal then
mcl_portals.spawn_nether_portal(pos, rot, pr, name)
elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true

View File

@ -18,6 +18,7 @@ mcl_structures.register_structure("woodland_cabin",{
modpath.."/schematics/mcl_structures_woodland_cabin.mts",
modpath.."/schematics/mcl_structures_woodland_outpost.mts",
},
construct_nodes = {"mcl_barrels:barrel_closed"},
after_place = function(p,def,pr)
local spawnon = {"mcl_deepslate:deepslate","mcl_core:birchwood","mcl_wool:red_carpet","mcl_wool:brown_carpet"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)

View File

@ -156,6 +156,9 @@ mcl_generate_fallen_logs (Generate fallen logs) bool false
# But creating new flat worlds after changing this setting should be safe.
mcl_superflat_classic (Classic superflat map generation) bool false
# If disabled, no deepslate will be generated.
mcl_generate_deepslate (Generate Deepslate) bool true
# If disabled, no ores will be generated.
mcl_generate_ores (Generate Ores) bool true
@ -194,3 +197,9 @@ mcl_item_id_debug (Item ID Debug) bool false
#Log mob spawning and despawning events
mcl_logging_mobs_spawn (Log Mob Spawning) bool true
# If enabled mapgen timings will be dumped to log
mcl_logging_mapgen (Chunk generation logging) bool false
# If enabled generated structures will be logged
mcl_logging_structures (Structure generation logging) bool true