Compare commits

...

42 Commits

Author SHA1 Message Date
cora 9ae9f8b3da Fix Structure loot generation (again) lol 2022-09-14 00:45:58 +02:00
cora 7f2f565946 Don't spawn the dragon in peaceful
and keep portal open
2022-09-14 00:45:58 +02:00
cora 1060b5074c Make end island larger 2022-09-14 00:45:58 +02:00
cora 44c07928f3 Fix undeclared var 2022-09-14 00:45:58 +02:00
cora 662ed5d999 Fix lighting issues in the end 2022-09-14 00:45:58 +02:00
cora f8da4d9ee3 Add logging settings for mapgen and structures
mapgen logging being default off and structure generation default
on as the latter is the far more useful of the 2 in most situations
2022-09-14 00:45:58 +02:00
cora d531e8dc89 Beams heal the dragon 2022-09-14 00:45:58 +02:00
cora f0408d20ea Nether portal -> struct api, add schematics 2022-09-14 00:45:58 +02:00
cora d52c57b653 Move end gateway portal to structure api 2022-09-14 00:45:58 +02:00
cora 56e10f6784 Add more variation to jungle schematics 2022-09-14 00:45:58 +02:00
cora cba931b752 Fix dragon spawning with crystals 2022-09-14 00:45:58 +02:00
cora 16800b1ac6 fix iron cage size, doubled dragon view range 2022-09-14 00:45:58 +02:00
cora 3dc5b56310 Fix gateway portals to come out on land 2022-09-14 00:45:58 +02:00
cora 98858f70d0 Make dragon spawn again, fix dragon fight 2022-09-14 00:45:58 +02:00
cora ce9862d55e Put register_generator api in a separate file 2022-09-14 00:45:58 +02:00
cora de84694a51 Fix barrels in woodland cabins 2022-09-14 00:45:58 +02:00
cora 39e05c31d2 Add iron cages to some obsidian pillars 2022-09-14 00:45:58 +02:00
cora 88c3816bb8 export xpanes.update_pane 2022-09-14 00:45:58 +02:00
cora f5a26a0253 Fix horrible mistake in xpanes 2022-09-14 00:45:58 +02:00
cora 8b4e3c3db0 Fix loot, elytra and shulker spawning 2022-09-14 00:45:58 +02:00
cora 14ce64fd5b add construct_nodes to structure api 2022-09-14 00:45:58 +02:00
cora b4809982c5 Add end boats and shipwrecks 2022-09-14 00:45:58 +02:00
cora cfb9a0cf56 Add End biomes, fix island decorations 2022-09-14 00:45:58 +02:00
cora ce6c173c28 Disable shulker natural spawning 2022-09-14 00:45:58 +02:00
cora 79f5afe0f6 Implement shulker teleportation 2022-09-14 00:45:58 +02:00
cora 4880436625 Immobilize shulkers 2022-09-14 00:45:58 +02:00
cora fd26d4f9c7 make the end island slightly larger
also uses the mcl_mapgen_core api now
2022-09-14 00:45:58 +02:00
cora 313d71e9a3 Add End island biome at spawn, proper end island 2022-09-14 00:45:58 +02:00
cora 8f070e5da3 Properly close exit portal 2022-09-14 00:45:58 +02:00
cora 2e1e04d499 Add End Spikes 2022-09-14 00:45:58 +02:00
cora f72626bf40 Fix inaccurate warning about spawn platform 2022-09-14 00:45:58 +02:00
cora 969b6a6138 Fix end lighting 2022-09-14 00:45:58 +02:00
cora c0c17da5fe Remove unused functions 2022-09-14 00:45:58 +02:00
cora c49ab06eb9 Exit portal and spawn platform -> mcl_structures 2022-09-14 00:45:58 +02:00
cora 1c02d68602 some refactoring 2022-09-14 00:45:58 +02:00
cora ad8c548473 Spawn clay as ore 2022-09-14 00:45:58 +02:00
cora d2bf912f94 Move jungle vines to jungle tree schematics 2022-09-14 00:45:58 +02:00
cora 5763bbd6db Enable deepslate and copper generation 2022-09-14 00:45:58 +02:00
cora 318b3a3905 Move v6 fixes to separate file 2022-09-14 00:45:58 +02:00
cora 44473ade85 move mapgen ores regs to separate file 2022-09-14 00:45:58 +02:00
cora 52fc21c806 Ensure consistent return portal from nether
this saves the linked portals in the portal node meta
2022-09-14 00:45:46 +02:00
cora 4fe5de85c8 Don't subtract items when placing in gm-creative 2022-09-14 00:45:34 +02:00
40 changed files with 2712 additions and 2304 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_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_official = mcl_vars.mg_end_min + minecraft_height_limit
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000 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 -- 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 mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max

View File

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

View File

@ -4,6 +4,50 @@
local S = minetest.get_translator("mobs_mc") 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", { mcl_mobs:register_mob("mobs_mc:enderdragon", {
description = S("Ender Dragon"), description = S("Ender Dragon"),
type = "monster", type = "monster",
@ -23,7 +67,7 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
{"mobs_mc_dragon.png"}, {"mobs_mc_dragon.png"},
}, },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
view_range = 35, view_range = 64,
walk_velocity = 6, walk_velocity = 6,
run_velocity = 6, run_velocity = 6,
can_despawn = false, can_despawn = false,
@ -61,45 +105,26 @@ mcl_mobs:register_mob("mobs_mc:enderdragon", {
run_start = 0, run_end = 20, run_start = 0, run_end = 20,
}, },
ignores_nametag = true, ignores_nametag = true,
do_custom = function(self) do_custom = function(self,dtime)
mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple") 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 if self._pos_timer == nil or self._pos_timer > POS_CHECK_FREQUENCY then
local luaentity = obj:get_luaentity() self._pos_timer = 0
if luaentity and luaentity.name == "mcl_end:crystal" then check_pos(self)
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
end end
if self._portal_pos then if self._beam_timer == nil or self._beam_timer > BEAM_CHECK_FREQUENCY then
-- migrate old format self._beam_timer = 0
if type(self._portal_pos) == "string" then check_beam(self)
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
end end
self._beam_timer = self._beam_timer + dtime
self._pos_timer = self._pos_timer + dtime
end, end,
on_die = function(self, pos) on_die = function(self, pos, cmi_cause)
if self._portal_pos then if self._portal_pos then
mcl_portals.spawn_gateway_portal() 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 if self._initial then
mcl_experience.throw_xp(pos, 11500) -- 500 + 11500 = 12000 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
end end
end, end,

View File

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

View File

@ -9,8 +9,27 @@ local S = minetest.get_translator("mobs_mc")
--################### SHULKER --################### 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 -- animation 45-80 is transition between passive and attack stance
mcl_mobs:register_mob("mobs_mc:shulker", { mcl_mobs:register_mob("mobs_mc:shulker", {
description = S("Shulker"), description = S("Shulker"),
type = "monster", type = "monster",
@ -35,6 +54,8 @@ mcl_mobs:register_mob("mobs_mc:shulker", {
walk_chance = 0, walk_chance = 0,
knock_back = false, knock_back = false,
jump = false, jump = false,
can_despawn = false,
fall_speed = 0,
drops = { drops = {
{name = "mcl_mobitems:shulker_shell", {name = "mcl_mobitems:shulker_shell",
chance = 2, chance = 2,
@ -44,15 +65,90 @@ mcl_mobs:register_mob("mobs_mc:shulker", {
looting_factor = 0.0625}, looting_factor = 0.0625},
}, },
animation = { 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, speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 45, stand_start = 0, stand_end = 25,
walk_start = 0, walk_end = 45, walk_start = 25, walk_end = 45,
run_start = 0, run_end = 45, run_start = 45, run_end = 85,
punch_start = 80, punch_end = 100, punch_start = 80, punch_end = 100,
}, },
view_range = 16, 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) -- 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:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0)
--[[
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
"mobs_mc:shulker", "mobs_mc:shulker",
"end", "end",
@ -97,3 +193,4 @@ minetest.LIGHT_MAX+1,
2, 2,
mcl_vars.mg_end_min, mcl_vars.mg_end_min,
mcl_vars.mg_end_max) mcl_vars.mg_end_max)
--]]

View File

@ -75,7 +75,7 @@ local function set_inventory(player, armor_change_only)
local form = "size[9,8.75]" .. local form = "size[9,8.75]" ..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]" .. "background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]" ..
mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "") .. mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "") ..
-- Armor -- Armor
"list[current_player;armor;0,0;1,1;1]" .. "list[current_player;armor;0,0;1,1;1]" ..
"list[current_player;armor;0,1;1,1;2]" .. "list[current_player;armor;0,1;1,1;2]" ..
@ -88,7 +88,7 @@ local function set_inventory(player, armor_change_only)
"list[current_player;offhand;3,2;1,1]" .. "list[current_player;offhand;3,2;1,1]" ..
mcl_formspec.get_itemslot_bg(3,2,1,1) .. mcl_formspec.get_itemslot_bg(3,2,1,1) ..
armor_slot_imgs .. armor_slot_imgs ..
-- Craft and inventory -- Craft and inventory
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))) .. "]" .. "label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))) .. "]" ..
"list[current_player;main;0,4.5;9,3;9]" .. "list[current_player;main;0,4.5;9,3;9]" ..
@ -100,34 +100,34 @@ local function set_inventory(player, armor_change_only)
mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1) .. mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1) ..
mcl_formspec.get_itemslot_bg(4, 1,2, 2) .. mcl_formspec.get_itemslot_bg(4, 1,2, 2) ..
mcl_formspec.get_itemslot_bg(7, 1.5, 1, 1) .. mcl_formspec.get_itemslot_bg(7, 1.5, 1, 1) ..
-- Crafting guide button -- Crafting guide button
"image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]" .. "image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]" ..
"tooltip[__mcl_craftguide;"..F(S("Recipe book")) .. "]" .. "tooltip[__mcl_craftguide;"..F(S("Recipe book")) .. "]" ..
-- Help button -- Help button
"image_button[8,3;1,1;doc_button_icon_lores.png;__mcl_doc;]" .. "image_button[8,3;1,1;doc_button_icon_lores.png;__mcl_doc;]" ..
"tooltip[__mcl_doc;" .. F(S("Help")) .. "]" "tooltip[__mcl_doc;" .. F(S("Help")) .. "]"
-- Skins button -- Skins button
if minetest.global_exists("mcl_skins") then if minetest.global_exists("mcl_skins") then
form = form .. form = form ..
"image_button[3,3;1,1;mcl_skins_button.png;__mcl_skins;]" .. "image_button[3,3;1,1;mcl_skins_button.png;__mcl_skins;]" ..
"tooltip[__mcl_skins;" .. F(S("Select player skin")) .. "]" "tooltip[__mcl_skins;" .. F(S("Select player skin")) .. "]"
end end
form = form .. form = form ..
-- Achievements button -- Achievements button
"image_button[7,3;1,1;mcl_achievements_button.png;__mcl_achievements;]" .. "image_button[7,3;1,1;mcl_achievements_button.png;__mcl_achievements;]" ..
"tooltip[__mcl_achievements;" .. F(S("Achievements")) .. "]" .. "tooltip[__mcl_achievements;" .. F(S("Achievements")) .. "]" ..
-- For shortcuts -- For shortcuts
"listring[current_player;main]" .. "listring[current_player;main]" ..
"listring[current_player;armor]" .. "listring[current_player;armor]" ..
"listring[current_player;main]" .. "listring[current_player;main]" ..
"listring[current_player;craft]" .. "listring[current_player;craft]" ..
"listring[current_player;main]" "listring[current_player;main]"
player:set_inventory_formspec(form) player:set_inventory_formspec(form)
end end
@ -218,6 +218,11 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
end end
end) end)
--Don't subtract from inv when placing in gamemode-creative
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if minetest.is_creative_enabled(placer:get_player_name()) then return true end
end)
local function in_table(n,h) local function in_table(n,h)
for k,v in pairs(h) do for k,v in pairs(h) do
if v == n then return true end if v == n then return true end

View File

@ -1,21 +1,15 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local S = minetest.get_translator(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 copper_mod = minetest.get_modpath("mcl_copper")
local cobble = "mcl_deepslate:deepslate_cobbled" local cobble = "mcl_deepslate:deepslate_cobbled"
local stick = "mcl_core:stick" local stick = "mcl_core:stick"
--[[ local function spawn_silverfish(pos, oldnode, oldmetadata, digger)
local mountains = { if not minetest.is_creative_enabled("") then
"ExtremeHills", "ExtremeHills_beach", "ExtremeHills_ocean", "ExtremeHills_deep_ocean", "ExtremeHills_underground", minetest.add_entity(pos, "mobs_mc:silverfish")
"ExtremeHills+", "ExtremeHills+_ocean", "ExtremeHills+_deep_ocean", "ExtremeHills+_underground", end
"ExtremeHillsM", "ExtremeHillsM_ocean", "ExtremeHillsM_deep_ocean", "ExtremeHillsM_underground", end
}
]]
minetest.register_node("mcl_deepslate:deepslate", { minetest.register_node("mcl_deepslate:deepslate", {
description = S("Deepslate"), description = S("Deepslate"),
@ -34,12 +28,6 @@ minetest.register_node("mcl_deepslate:deepslate", {
_mcl_silk_touch_drop = true, _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", { minetest.register_node("mcl_deepslate:infested_deepslate", {
description = S("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."), _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 function register_deepslate_variant(item, desc, longdesc)
local texture = desc:lower():gsub("% ", "_") local texture = desc:lower():gsub("% ", "_")
local def = { local def = {
@ -424,6 +245,13 @@ for _, p in pairs({ "bricks", "tiles" }) do
}) })
end end
minetest.register_craft({
type = "cooking",
output = "mesecons:redstone",
recipe = "mcl_deepslate:deepslate_with_redstone",
cooktime = 10,
})
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "mcl_deepslate:deepslate", output = "mcl_deepslate:deepslate",

View File

@ -65,12 +65,15 @@ local function spawn_crystal(pos)
crystals[i] = find_crystal(crystal_pos) crystals[i] = find_crystal(crystal_pos)
if not crystals[i] then return end if not crystals[i] then return end
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
end
for _, crystal in pairs(crystals) do for _, crystal in pairs(crystals) do
crystal_explode(crystal) crystal_explode(crystal)
end end
local portal_pos = vector.add(portal_center, vector.new(-3, -1, -3)) local portal_pos = vector.add(portal_center, vector.new(0, -1, 0))
mcl_structures.call_struct(portal_pos, "end_exit_portal") mcl_structures.place_structure(portal_pos,mcl_structures.registered_structures["end_exit_portal"],PseudoRandom(minetest.get_mapgen_setting("seed")),-1)
minetest.add_entity(vector.add(portal_pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = portal_pos
end end
minetest.register_entity("mcl_end:crystal", { minetest.register_entity("mcl_end:crystal", {

View File

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

View File

@ -1,4 +1,4 @@
name = mcl_portals name = mcl_portals
description = Adds buildable portals to the Nether and End dimensions. 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 optional_depends = awards, doc

View File

@ -1,4 +1,6 @@
local S = minetest.get_translator(minetest.get_current_modname()) local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
local SCAN_2_MAP_CHUNKS = true -- slower but helps to find more suitable places local SCAN_2_MAP_CHUNKS = true -- slower but helps to find more suitable places
@ -90,6 +92,27 @@ local limits = {
}, },
} }
local function save_portal_pos(pos,target_pos)
local p1 = vector.offset(pos,-2,-1,-2)
local p2 = vector.offset(pos,2,15,2)
local nn = find_nodes_in_area(p1,p2,{"mcl_portals:portal"})
for _,p in pairs(nn) do
minetest.get_meta(p):set_string("target_portal",minetest.hash_node_position(target_pos))
end
end
local function get_portal_pos(pos)
local p1 = vector.offset(pos,-5,-1,-5)
local p2 = vector.offset(pos,5,5,5)
local nn = find_nodes_in_area(p1,p2,{"mcl_portals:portal"})
for _,p in pairs(nn) do
local m = minetest.get_meta(p):get_string("target_portal")
if m and m ~= "" and mcl_vars.get_node(p).name == "mcl_portals:portal" then
return minetest.get_position_from_hash(m)
end
end
end
-- This function registers exits from Nether portals. -- This function registers exits from Nether portals.
-- Incoming verification performed: two nodes must be portal nodes, and an obsidian below them. -- Incoming verification performed: two nodes must be portal nodes, and an obsidian below them.
-- If the verification passes - position adds to the table and saves to mod storage on exit. -- If the verification passes - position adds to the table and saves to mod storage on exit.
@ -406,6 +429,10 @@ local function finalize_teleport(obj, exit)
end end
local _, dim = mcl_worlds.y_to_layer(exit.y) local _, dim = mcl_worlds.y_to_layer(exit.y)
local saved_portal = find_exit(get_portal_pos(objpos),10,10,10)
if saved_portal then exit = saved_portal end
-- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y -- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y
objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)} objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)}
@ -421,8 +448,11 @@ local function finalize_teleport(obj, exit)
teleport_cooloff(obj) teleport_cooloff(obj)
-- Teleport -- Teleport
save_portal_pos(objpos,exit)
obj:set_pos(exit) obj:set_pos(exit)
minetest.after(1,function()
save_portal_pos(exit,objpos)
end)
if is_player then if is_player then
mcl_worlds.dimension_change(obj, dim) mcl_worlds.dimension_change(obj, dim)
minetest.sound_play("mcl_portals_teleport", {pos=exit, gain=0.5, max_hear_distance = 16}, true) minetest.sound_play("mcl_portals_teleport", {pos=exit, gain=0.5, max_hear_distance = 16}, true)
@ -876,3 +906,18 @@ minetest.override_item(OBSIDIAN, {
end end
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 end
minetest.register_on_placenode(function(pos, node) minetest.register_on_placenode(function(pos, node)
if minetest.get_item_group(node, "pane") then if minetest.get_item_group(node.name, "pane") <= 0 then return end
update_pane(pos) update_pane(pos)
end
for i = 0, 3 do for i = 0, 3 do
local dir = minetest.facedir_to_dir(i) local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir)) update_pane(vector.add(pos, dir))
end end
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 for i = 0, 3 do
local dir = minetest.facedir_to_dir(i) local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir)) update_pane(vector.add(pos, dir))
@ -86,6 +86,7 @@ minetest.register_on_dignode(function(pos)
end) end)
xpanes = {} xpanes = {}
xpanes.update_pane = update_pane
function xpanes.register_pane(name, def) function xpanes.register_pane(name, def)
for i = 1, 15 do for i = 1, 15 do
minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat") 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_blackstone = minetest.get_modpath("mcl_blackstone")
local mod_mcl_mangrove = minetest.get_modpath("mcl_mangrove") 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 local deco_id_chorus_plant
-- --
@ -1727,12 +1724,90 @@ local function register_dimension_biomes()
node_water = "air", node_water = "air",
node_river_water = "air", node_river_water = "air",
node_cave_liquid = "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_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max + 80, 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, heat_point = 50,
humidity_point = 50, humidity_point = 50,
vertical_blend = 16,
_mcl_biome_type = "medium", _mcl_biome_type = "medium",
_mcl_palette_index = 0, _mcl_palette_index = 0,
}) })
@ -2382,10 +2457,47 @@ local function register_dimension_ores()
end_wherein = {"air"} end_wherein = {"air"}
end end
local mult = 1.0
minetest.register_ore({ minetest.register_ore({
ore_type = "stratum", ore_type = "stratum",
ore = "mcl_end:end_stone", ore = "mcl_end:end_stone",
wherein = end_wherein, 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_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80, y_max = mcl_vars.mg_end_min+80,
@ -2413,6 +2525,7 @@ local function register_dimension_ores()
ore_type = "stratum", ore_type = "stratum",
ore = "mcl_end:end_stone", ore = "mcl_end:end_stone",
wherein = end_wherein, wherein = end_wherein,
biomes = {"End","EndMidlands","EndHighlands","EndBarrens"},
y_min = mcl_vars.mg_end_min+64, y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80, y_max = mcl_vars.mg_end_min+80,
@ -2439,6 +2552,7 @@ local function register_dimension_ores()
ore_type = "stratum", ore_type = "stratum",
ore = "mcl_end:end_stone", ore = "mcl_end:end_stone",
wherein = end_wherein, wherein = end_wherein,
biomes = {"End","EndMidlands","EndHighlands","EndBarrens"},
y_min = mcl_vars.mg_end_min+64, y_min = mcl_vars.mg_end_min+64,
y_max = mcl_vars.mg_end_min+80, y_max = mcl_vars.mg_end_min+80,
@ -3149,13 +3263,13 @@ local function register_decorations()
-- Jungle tree -- Jungle tree
-- Huge jungle tree (2 variants) -- Huge jungle tree (4 variants)
for i=1, 2 do for i=1, 4 do
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.00125, fill_ratio = 0.0008,
biomes = {"Jungle"}, biomes = {"Jungle"},
y_min = 4, y_min = 4,
y_max = mcl_vars.mg_overworld_max, y_max = mcl_vars.mg_overworld_max,
@ -3167,7 +3281,7 @@ local function register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.004, fill_ratio = 0.003,
biomes = {"JungleM"}, biomes = {"JungleM"},
y_min = 4, y_min = 4,
y_max = mcl_vars.mg_overworld_max, y_max = mcl_vars.mg_overworld_max,
@ -3182,7 +3296,55 @@ local function register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"}, place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
sidelen = 80, 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"}, biomes = {"Jungle"},
y_min = 1, y_min = 1,
y_max = mcl_vars.mg_overworld_max, y_max = mcl_vars.mg_overworld_max,
@ -3211,11 +3373,10 @@ local function register_decorations()
biomes = {"JungleM"}, biomes = {"JungleM"},
y_min = 1, y_min = 1,
y_max = mcl_vars.mg_overworld_max, 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", flags = "place_center_x, place_center_z",
rotation = "random", rotation = "random",
}) })
-- Spruce -- Spruce
local function quick_spruce(seed, offset, sprucename, biomes, y) local function quick_spruce(seed, offset, sprucename, biomes, y)
if not y then if not y then
@ -3538,6 +3699,18 @@ local function register_decorations()
rotation = "0", 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 --Mushrooms in caves
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
@ -3800,7 +3973,7 @@ local function register_decorations()
sidelen = 80, sidelen = 80,
noise_params = { noise_params = {
offset = 0.0196, offset = 0.0196,
scale = 0.025, scale = 0.015,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2930, seed = 2930,
octaves = 4, octaves = 4,
@ -3809,7 +3982,25 @@ local function register_decorations()
biomes = {"Jungle"}, biomes = {"Jungle"},
y_min = 3, y_min = 3,
y_max = mcl_vars.mg_overworld_max, 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", flags = "place_center_x, place_center_z",
}) })
minetest.register_decoration({ minetest.register_decoration({
@ -3827,7 +4018,7 @@ local function register_decorations()
biomes = {"JungleM"}, biomes = {"JungleM"},
y_min = 1, y_min = 1,
y_max = mcl_vars.mg_overworld_max, 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", flags = "place_center_x, place_center_z",
}) })
minetest.register_decoration({ minetest.register_decoration({
@ -3845,7 +4036,7 @@ local function register_decorations()
biomes = {"JungleEdge", "JungleEdgeM"}, biomes = {"JungleEdge", "JungleEdgeM"},
y_min = 3, y_min = 3,
y_max = mcl_vars.mg_overworld_max, 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", flags = "place_center_x, place_center_z",
}) })
@ -4829,9 +5020,9 @@ local function register_dimension_decorations()
-- Chorus plant -- Chorus plant
minetest.register_decoration({ minetest.register_decoration({
name = "mcl_biomes:chorus_plant", name = "mcl_biomes:chorus",
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_end:end_stone", "air"}, place_on = {"mcl_end:end_stone"},
flags = "all_floors", flags = "all_floors",
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
@ -4844,9 +5035,31 @@ local function register_dimension_decorations()
}, },
y_min = mcl_vars.mg_end_min, y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max, 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", decoration = "mcl_end:chorus_flower",
height = 1, height = 1,
biomes = { "End" }, biomes = { "End", "EndMidlands", "EndHighlands", "EndBarrens", "EndSmallIslands" },
}) })
deco_id_chorus_plant = minetest.get_decoration_id("mcl_biomes:chorus_plant") 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 if minp.y > -26900 then return end
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z 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 realpos = { x = x, y = y + 1, z = z }
local node = minetest.get_node(realpos) local node = minetest.get_node(realpos)
if node and node.name == "mcl_end:chorus_flower" then if node and node.name == "mcl_end:chorus_flower" then

View File

@ -1,34 +1,40 @@
local width = 200
local noisemap = PerlinNoiseMap({ local noisemap = PerlinNoiseMap({
offset = 0.5, offset = 0.5,
scale = 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, seed = minetest.get_mapgen_setting("seed") + 99999,
octaves = 4, octaves = 4,
persist = 0.85, 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 c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local y_offset = -2 local y_offset = -2
minetest.register_on_generated(function(minp, maxp) 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 < -75 or minp.x > 75 or maxp.z < -75 or minp.z > 75 then 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 return
end end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") 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 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
local pos = area:position(idx) local pos = area:position(idx)
local y = 27025 + pos.y - y_offset 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 data[idx] = c_end_stone
end end
end end
return true,false,false
vm:set_data(data) end, function(minp,maxp,blockseed)
vm:calc_lighting() 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
vm:update_liquids() return
vm:write_to_map() end
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 name = mcl_end_island
author = Fleckenstein author = Fleckenstein
depends = mcl_mapgen_core, mcl_end depends = mcl_mapgen_core, mcl_end, mcl_mobs
description = Generate the end main island for MCL2 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 name = mcl_mapgen_core
author = Wuzzy author = Wuzzy
description = The core of the MCL2 mapgen 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 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 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(",") if disabled_structures then disabled_structures = disabled_structures:split(",")
else disabled_structures = {} end else disabled_structures = {} end
local logging = minetest.settings:get_bool("mcl_logging_structures",true)
function mcl_structures.is_disabled(structname) 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 end
function mcl_structures.fill_chests(p1,p2,loot,pr) function mcl_structures.fill_chests(p1,p2,loot,pr)
@ -22,12 +24,19 @@ function mcl_structures.fill_chests(p1,p2,loot,pr)
end end
local function generate_loot(pos, def, pr) 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 p1 = vector.offset(pos,-hl,-hl,-hl)
local p2 = 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 if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end
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) function mcl_structures.find_lowest_y(pp)
local y = 31000 local y = 31000
@ -129,7 +138,7 @@ end
function mcl_structures.place_structure(pos, def, pr, blockseed) function mcl_structures.place_structure(pos, def, pr, blockseed)
if not def then return end 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 local y_offset = 0
if type(def.y_offset) == "function" then if type(def.y_offset) == "function" then
y_offset = def.y_offset(pr) y_offset = def.y_offset(pr)
@ -146,7 +155,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed)
if def.make_foundation then 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) 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 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.") minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.")
end end
return false return false
@ -154,7 +163,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed)
end end
end end
if def.on_place and not def.on_place(pos,def,pr,blockseed) then 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.") minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. Conditions not satisfied.")
end end
return false 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 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) 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 if def.loot then generate_loot(pp,def,pr,blockseed) end
return ap(pos,def,pr,blockseed) if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
return ap(pp,def,pr,blockseed)
end,pr) end,pr)
if logging then if log_enabled then
minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp)) minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp))
end end
return true return true
end end
elseif def.place_func and def.place_func(pos,def,pr,blockseed) 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(pos,def,pr,blockseed) ) then if not def.after_place or ( def.after_place and def.after_place(pp,def,pr,blockseed) ) then
if logging 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)) minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp))
end end
return true return true
end end
end end
if logging then if log_enabled then
minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos)) minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos))
end end
end end
@ -201,28 +213,31 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
sbgroups.structblock = nil sbgroups.structblock = nil
sbgroups.structblock_lbm = 1 sbgroups.structblock_lbm = 1
else else
minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered if def.place_on then
def.deco = minetest.register_decoration({ minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered
name = "mcl_structures:deco_"..name, def.deco = minetest.register_decoration({
decoration = structblock, name = "mcl_structures:deco_"..name,
deco_type = "simple", decoration = structblock,
place_on = def.place_on, deco_type = "simple",
spawn_by = def.spawn_by, place_on = def.place_on,
num_spawn_by = def.num_spawn_by, spawn_by = def.spawn_by,
sidelen = 80, num_spawn_by = def.num_spawn_by,
fill_ratio = def.fill_ratio, sidelen = 80,
noise_params = def.noise_params, fill_ratio = def.fill_ratio,
flags = flags, noise_params = def.noise_params,
biomes = def.biomes, flags = flags,
y_max = def.y_max, biomes = def.biomes,
y_min = def.y_min 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 minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,})
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) def.structblock = structblock
minetest.set_gen_notify({decoration=true}, { def.deco_id }) def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name)
--catching of gennotify happens in mcl_mapgen_core minetest.set_gen_notify({decoration=true}, { def.deco_id })
end) --catching of gennotify happens in mcl_mapgen_core
end)
end
end end
mcl_structures.registered_structures[name] = def mcl_structures.registered_structures[name] = def
end 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 if not rotation then
rotation = "random" rotation = "random"
end end
if struct_style == "end_exit_portal" then if struct_style == "end_portal_shrine" 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
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr) return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
end end
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) local function shrine_placement_callback(p1, p2, size, rotation, pr)
-- Find and setup spawner with silverfish -- Find and setup spawner with silverfish
local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner") 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.."/ruined_portal.lua")
dofile(modpath.."/geode.lua") dofile(modpath.."/geode.lua")
dofile(modpath.."/pillager_outpost.lua") dofile(modpath.."/pillager_outpost.lua")
dofile(modpath.."/end_spawn.lua")
dofile(modpath.."/end_city.lua")
mcl_structures.register_structure("desert_well",{ mcl_structures.register_structure("desert_well",{
@ -310,7 +290,7 @@ mcl_structures.register_structure("ice_spike_large",{
-- Debug command -- Debug command
minetest.register_chatcommand("spawnstruct", { 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."), description = S("Generate a pre-defined structure near your position."),
privs = {debug = true}, privs = {debug = true},
func = function(name, param) func = function(name, param)
@ -324,18 +304,10 @@ minetest.register_chatcommand("spawnstruct", {
local pr = PseudoRandom(pos.x+pos.y+pos.z) local pr = PseudoRandom(pos.x+pos.y+pos.z)
local errord = false local errord = false
local message = S("Structure placed.") local message = S("Structure placed.")
if param == "end_exit_portal" then if param == "end_portal_shrine" 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
mcl_structures.generate_end_portal_shrine(pos, rot, pr) mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
mcl_dungeons.spawn_dungeon(pos, rot, pr) 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 elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.") message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true 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_cabin.mts",
modpath.."/schematics/mcl_structures_woodland_outpost.mts", modpath.."/schematics/mcl_structures_woodland_outpost.mts",
}, },
construct_nodes = {"mcl_barrels:barrel_closed"},
after_place = function(p,def,pr) after_place = function(p,def,pr)
local spawnon = {"mcl_deepslate:deepslate","mcl_core:birchwood","mcl_wool:red_carpet","mcl_wool:brown_carpet"} 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) 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. # But creating new flat worlds after changing this setting should be safe.
mcl_superflat_classic (Classic superflat map generation) bool false 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. # If disabled, no ores will be generated.
mcl_generate_ores (Generate Ores) bool true 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 #Log mob spawning and despawning events
mcl_logging_mobs_spawn (Log Mob Spawning) bool true 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