Merge pull request 'Playable nether' (#2836) from nether_mg_settings into master

Reviewed-on: MineClone2/MineClone2#2836
This commit is contained in:
cora 2022-11-02 04:32:01 +00:00
commit 6851a53c6c
39 changed files with 822 additions and 133 deletions

View File

@ -138,6 +138,7 @@ mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border
mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128 mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128
mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min
mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max
mcl_vars.mg_nether_deco_max = mcl_vars.mg_nether_max -11 -- this is so ceiling decorations don't spill into other biomes as bedrock generation calls minetest.generate_decorations to put netherrack under the bedrock
if not superflat then if not superflat then
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4 mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4 mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4

View File

@ -23,6 +23,7 @@ function table.update_nil(t, ...)
end end
function mcl_util.file_exists(name) function mcl_util.file_exists(name)
if type(name) ~= "string" then return end
local f = io.open(name) local f = io.open(name)
if not f then if not f then
return false return false

View File

@ -672,8 +672,8 @@ if mobs_spawn then
return return
end end
end end
if minetest.registered_entities[mob_def.name].can_spawn and not minetest.registered_entities[mob_def.name].can_spawn(pos) then if minetest.registered_entities[mob_def.name].can_spawn and not minetest.registered_entities[mob_def.name].can_spawn(spawning_position) then
minetest.log("warning","[mcl_mobs] mob "..mob_def.name.." refused to spawn at "..minetest.pos_to_string(vector.round(pos))) minetest.log("warning","[mcl_mobs] mob "..mob_def.name.." refused to spawn at "..minetest.pos_to_string(vector.round(spawning_position)))
return return
end end
--everything is correct, spawn mob --everything is correct, spawn mob

View File

@ -154,3 +154,5 @@ dofile(path .. "/glow_squid.lua")
dofile(path .. "/piglin.lua") dofile(path .. "/piglin.lua")
dofile(path .. "/hoglin+zoglin.lua") dofile(path .. "/hoglin+zoglin.lua")
dofile(path .. "/strider.lua")

Binary file not shown.

View File

@ -99,6 +99,7 @@ mcl_mobs:register_mob("mobs_mc:witherskeleton", {
}) })
--spawn --spawn
--[[]
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(
"mobs_mc:witherskeleton", "mobs_mc:witherskeleton",
"nether", "nether",
@ -114,6 +115,6 @@ mcl_mobs:spawn_specific(
5, 5,
mcl_vars.mg_nether_min, mcl_vars.mg_nether_min,
mcl_vars.mg_nether_max) mcl_vars.mg_nether_max)
--]]
-- spawn eggs -- spawn eggs
mcl_mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "#141414", "#474d4d", 0) mcl_mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "#141414", "#474d4d", 0)

View File

@ -0,0 +1,249 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("mobs_mc")
--###################
--################### STRIDER
--###################
local strider = {
type = "animal",
passive = true,
spawn_class = "passive",
hp_min = 20,
hp_max = 20,
xp_min = 9,
xp_max = 9,
armor = {fleshy = 90},
attack_type = "dogfight",
damage = 2,
reach = 2,
collisionbox = {-.6, -0.01, -.6, .6, 1.94, .6},
visual = "mesh",
mesh = "extra_mobs_strider.b3d",
textures = { {
"extra_mobs_strider.png",
} },
visual_size = {x=3, y=3},
sounds = {
},
jump = true,
makes_footstep_sound = true,
walk_velocity = 2,
run_velocity = 4,
runaway = true,
drops = {
{name = "mcl_mobsitems:string",
chance = 1,
min = 2,
max = 5,},
},
animation = {
stand_speed = 15,
walk_speed = 15,
run_speed = 30,
stand_start = 5,
stand_end = 5,
walk_start = 1,
walk_end = 20,
},
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
water_damage = 5,
fear_height = 4,
view_range = 16,
fire_resistant = true,
floats_on_lava = 1,
floats = 0,
can_spawn = function(pos)
local l = minetest.find_node_near(pos,2,{"mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"})
return l ~= nil
end,
do_custom = function(self, dtime)
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then
self.walk_velocity = 2
self.run_velocity = 4
self.base_texture[1] = "extra_mobs_strider.png"
self.shaking = false
else
self.base_texture[1] = "extra_mobs_strider_cold.png"
self.walk_velocity = .5
self.run_velocity = 1
self.shaking = true
end
self.object:set_properties({textures=self.base_texture, shaking=self.shaking, run_velocity=self.run_velocity, walk_velocity=self.walk_velocity})
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 8
self.max_speed_reverse = 4
self.accel = 2
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 5.5, z = -1.75}
self.driver_eye_offset = {x = 0, y = 10, z = 0}
self.driver_scale = {x = 1/self.visual_size.x, y = 1/self.visual_size.y}
end
-- if driver present allow control of horse
if self.driver then
local pos = self.object:get_pos()
local v = self.object:get_velocity()
self.object:set_velocity(vector.new(v.x,0,v.z))
mcl_mobs.drive(self, "walk", "stand", false, dtime)
local l = minetest.find_node_near(pos,2,{"group:lava"})
if l then self.object:set_pos(vector.new(pos.x,l.y+0.5,pos.z)) end
return false -- skip rest of mob functions
end
return true
end,
on_die = function(self, pos)
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
end,
on_rightclick = function(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local wielditem = clicker:get_wielded_item()
if wielditem:get_name() ~= "mcl_crimson:warped_fungus" then
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
end
if self.child then
return
end
local item = clicker:get_wielded_item()
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
self.base_texture = {
"extra_mobs_strider.png",
"mobs_mc_pig_saddle.png", -- saddle
}
self.object:set_properties({
textures = self.base_texture
})
self.saddle = "yes"
self.tamed = true
self.drops = {
{name = "mcl_mobitems:string",
chance = 1,
min = 1,
max = 3,},
{name = "mcl_mobitems:saddle",
chance = 1,
min = 1,
max = 1,},
}
if not minetest.is_creative_enabled(clicker:get_player_name()) then
wielditem:take_item(1)
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), wielditem)
end
minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=8, pos=self.object:get_pos()}, true)
return
end
-- Mount or detach player
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
-- Detach if already attached
mcl_mobs.detach(clicker, {x=1, y=0, z=0})
return
elseif not self.driver and self.saddle == "yes" and wielditem:get_name() == "mcl_mobitems:warped_fungus_on_a_stick" then
-- Ride pig if it has a saddle and player uses a carrot on a stick
mcl_mobs.attach(self, clicker)
if not minetest.is_creative_enabled(clicker:get_player_name()) then
local inv = self.driver:get_inventory()
-- 26 uses
if wielditem:get_wear() > 63000 then
-- Break carrot on a stick
local def = wielditem:get_definition()
if def.sounds and def.sounds.breaks then
minetest.sound_play(def.sounds.breaks, {pos = clicker:get_pos(), max_hear_distance = 8, gain = 0.5}, true)
end
wielditem = {name = mobs_mc.items.fishing_rod, count = 1}
else
wielditem:add_wear(2521)
end
inv:set_stack("main",self.driver:get_wield_index(), wielditem)
end
return
end
end,
}
mcl_mobs:register_mob("mobs_mc:strider", strider)
-- Baby strider.
local baby_strider = table.copy(strider)
baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
baby_strider.xp_min = 13
baby_strider.xp_max = 13
baby_strider.visual_size = {x=strider.visual_size.x/2, y=strider.visual_size.y/2}
textures = { {
"extra_mobs_strider.png",
"extra_mobs_trans.png",
} }
baby_strider.walk_velocity = 1.2
baby_strider.run_velocity = 2.4
baby_strider.child = 1
mcl_mobs:register_mob("mobs_mc:baby_strider", baby_strider)
-- Regular spawning in the Nether
mcl_mobs:spawn_setup({
name = "mobs_mc:strider",
type_of_spawning = "lava",
dimension = "nether",
biomes = {
"Nether",
"BasaltDelta",
"WarpedForest",
"CrimsonForest",
"SoulsandValley"
},
min_height = mcl_vars.mg_nether_min,
max_height = mcl_vars.mg_nether_max,
chance = 2000,
})
mcl_mobs:spawn_setup({
name = "mobs_mc:baby_strider",
type_of_spawning = "lava",
dimension = "nether",
biomes = {
"Nether",
"BasaltDelta",
"WarpedForest",
"CrimsonForest",
"SoulsandValley"
},
min_height = mcl_vars.mg_nether_min,
max_height = mcl_vars.mg_nether_max,
chance = 100,
})
-- spawn eggs
mcl_mobs:register_egg("mobs_mc:strider", S("Strider"), "#000000", "#FF0000", 0)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -42,7 +42,7 @@ mcl_mobs:register_mob("mobs_mc:wither", {
fly = true, fly = true,
makes_footstep_sound = false, makes_footstep_sound = false,
dogshoot_switch = 1, dogshoot_switch = 1,
dogshoot_count_max =1, dogshoot_count_max = 1,
attack_animals = true, attack_animals = true,
can_despawn = false, can_despawn = false,
drops = { drops = {
@ -79,9 +79,11 @@ mcl_mobs:register_mob("mobs_mc:wither", {
on_spawn = function(self) on_spawn = function(self)
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64}) minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
end, end,
}) })
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
mcl_mobs:register_arrow("mobs_mc:wither_skull", { mcl_mobs:register_arrow("mobs_mc:wither_skull", {
visual = "sprite", visual = "sprite",
@ -105,6 +107,18 @@ mcl_mobs:register_arrow("mobs_mc:wither_skull", {
damage_groups = {fleshy = 8}, damage_groups = {fleshy = 8},
}, nil) }, nil)
mcl_mobs:boom(self, self.object:get_pos(), 1) mcl_mobs:boom(self, self.object:get_pos(), 1)
local l = mob:get_luaentity()
if l and l.health - 8 <= 0 then
local n = minetest.find_node_near(mob:get_pos(),2,wither_rose_soil)
if n then
local p = vector.offset(n,0,1,0)
if minetest.get_node(p).name == "air" then
if not ( mobs_griefing and minetest.place_node(p,{name="mcl_flowers:wither_rose"}) ) then
minetest.add_item(p,"mcl_flowers:wither_rose")
end
end
end
end
end, end,
-- node hit, explode -- node hit, explode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 958 B

View File

@ -51,6 +51,9 @@ local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos,
if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then
light_ok = true light_ok = true
end end
if itemstack:get_name() == "mcl_flowers:wither_rose" and ( minetest.get_item_group(soil_node.name, "grass_block") > 0 or soil_node.name == "mcl_core:dirt" or soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_mud:mud" or soil_node.name == "mcl_moss:moss" or soil_node.name == "mcl_nether:netherrack" or minetest.get_item_group(soil_node.name, "soul_block") > 0 ) then
return true,colorize
end
local is_flower = minetest.get_item_group(itemstack:get_name(), "flower") == 1 local is_flower = minetest.get_item_group(itemstack:get_name(), "flower") == 1
local ok = (soil_node.name == "mcl_core:dirt" or minetest.get_item_group(soil_node.name, "grass_block") == 1 or (not is_flower and (soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_core:podzol" or soil_node.name == "mcl_core:podzol_snow"))) and light_ok local ok = (soil_node.name == "mcl_core:dirt" or minetest.get_item_group(soil_node.name, "grass_block") == 1 or (not is_flower and (soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_core:podzol" or soil_node.name == "mcl_core:podzol_snow"))) and light_ok
return ok, colorize return ok, colorize

View File

@ -60,3 +60,9 @@ mcl_flowers.register_simple_flower("blue_orchid", {
selection_box = { -5/16, -0.5, -5/16, 5/16, 7/16, 5/16 }, selection_box = { -5/16, -0.5, -5/16, 5/16, 7/16, 5/16 },
potted = true, potted = true,
}) })
mcl_flowers.register_simple_flower("wither_rose", {
desc = S("Wither Rose"),
image = "mcl_flowers_wither_rose.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 },
potted = true,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -327,6 +327,17 @@ minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
}) })
minetest.register_tool("mcl_mobitems:warped_fungus_on_a_stick", {
description = S("Warped fungus on a Stick"),
_tt_help = S("Lets you ride a strider"),
_doc_items_longdesc = S("A warped fungus on a stick can be used on saddled striders to ride them."),
_doc_items_usagehelp = S("Place it on a saddled strider to mount it. You can now ride the strider like a horse. Striders will also walk towards you when you just wield the carrot on a stick."),
wield_image = "mcl_mobitems_warped_fungus_on_a_stick.png^[transformFY^[transformR90",
inventory_image = "mcl_mobitems_warped_fungus_on_a_stick.png",
groups = { transport = 1 },
_mcl_toollike_wield = true,
})
minetest.register_craftitem("mcl_mobitems:nautilus_shell", { minetest.register_craftitem("mcl_mobitems:nautilus_shell", {
description = S("Nautilus Shell"), description = S("Nautilus Shell"),
_tt_help = S("Used to craft a conduit"), _tt_help = S("Used to craft a conduit"),
@ -450,6 +461,22 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
output = "mcl_mobitems:warped_fungus_on_a_stick",
recipe = {
{ "mcl_fishing:fishing_rod", "", },
{ "", "mcl_crimson:warped_fungus" },
},
})
minetest.register_craft({
output = "mcl_mobitems:warped_fungus_on_a_stick",
recipe = {
{ "","mcl_fishing:fishing_rod", },
{ "mcl_crimson:warped_fungus", "" },
},
})
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "mcl_mobitems:magma_cream", output = "mcl_mobitems:magma_cream",

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -1531,10 +1531,40 @@ local function register_dimension_biomes()
--[[ REALMS ]] --[[ REALMS ]]
--[[ THE NETHER ]] --[[ THE NETHER ]]
-- the following decoration is a hack to cover exposed bedrock in netherrack - be careful not to put any ceiling decorations in a way that would apply to this (they would get generated regardless of biome)
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:bedrock"},
sidelen = 16,
fill_ratio = 10,
y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max + 15,
height = 6,
max_height = 10,
decoration = "mcl_nether:netherrack",
flags = "all_ceilings",
param2 = 0,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:bedrock"},
sidelen = 16,
fill_ratio = 10,
y_min = mcl_vars.mg_nether_min - 10,
y_max = mcl_vars.mg_lava_nether_max,
height = 7,
max_height = 14,
decoration = "mcl_nether:netherrack",
flags = "all_floors,force_placement",
param2 = 0,
})
minetest.register_biome({ minetest.register_biome({
name = "Nether", name = "Nether",
node_filler = "mcl_nether:netherrack", node_filler = "mcl_nether:netherrack",
node_stone = "mcl_nether:netherrack", node_stone = "mcl_nether:netherrack",
node_top = "mcl_nether:netherrack",
node_water = "air", node_water = "air",
node_river_water = "air", node_river_water = "air",
node_cave_liquid = "air", node_cave_liquid = "air",
@ -1549,12 +1579,12 @@ local function register_dimension_biomes()
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand"}, place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand","mcl_nether:glowstone","mcl_nether:magma"},
sidelen = 16, sidelen = 16,
fill_ratio = 10, fill_ratio = 10,
biomes = { "Nether" }, biomes = { "Nether" },
y_min = -31000, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_deco_max,
decoration = "mcl_nether:netherrack", decoration = "mcl_nether:netherrack",
flags = "all_floors", flags = "all_floors",
param2 = 0, param2 = 0,
@ -1569,7 +1599,6 @@ local function register_dimension_biomes()
node_river_water = "air", node_river_water = "air",
node_cave_liquid = "air", node_cave_liquid = "air",
y_min = mcl_vars.mg_nether_min, y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_nether_max + 80, y_max = mcl_vars.mg_nether_max + 80,
heat_point = 77, heat_point = 77,
humidity_point = 33, humidity_point = 33,
@ -1578,12 +1607,12 @@ local function register_dimension_biomes()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone"}, place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_nether:magma"},
sidelen = 16, sidelen = 16,
fill_ratio = 10, fill_ratio = 10,
biomes = { "SoulsandValley" }, biomes = { "SoulsandValley" },
y_min = -31000, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_deco_max,
decoration = "mcl_blackstone:soul_soil", decoration = "mcl_blackstone:soul_soil",
flags = "all_floors, all_ceilings", flags = "all_floors, all_ceilings",
param2 = 0, param2 = 0,
@ -1597,8 +1626,8 @@ local function register_dimension_biomes()
clust_num_ores = 225, clust_num_ores = 225,
clust_size = 15, clust_size = 15,
biomes = { "SoulsandValley" }, biomes = { "SoulsandValley" },
y_min = mcl_vars.mg_nether_min, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max + 80, y_max = mcl_vars.mg_nether_deco_max,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 1, scale = 1,
@ -1619,7 +1648,6 @@ local function register_dimension_biomes()
node_river_water = "air", node_river_water = "air",
node_cave_liquid = "air", node_cave_liquid = "air",
y_min = mcl_vars.mg_nether_min, y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_nether_max + 80, y_max = mcl_vars.mg_nether_max + 80,
heat_point = 60, heat_point = 60,
humidity_point = 47, humidity_point = 47,
@ -1628,12 +1656,12 @@ local function register_dimension_biomes()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand"}, place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand","mcl_nether:magma","mcl_blackstone:blackstone"},
sidelen = 16, sidelen = 16,
fill_ratio = 10, fill_ratio = 10,
biomes = { "CrimsonForest" }, biomes = { "CrimsonForest" },
y_min = -31000, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_deco_max,
decoration = "mcl_crimson:crimson_nylium", decoration = "mcl_crimson:crimson_nylium",
flags = "all_floors", flags = "all_floors",
param2 = 0, param2 = 0,
@ -1655,12 +1683,12 @@ local function register_dimension_biomes()
}) })
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand"}, place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand","mcl_nether:magma","mcl_blackstone:blackstone"},
sidelen = 16, sidelen = 16,
fill_ratio = 10, fill_ratio = 10,
biomes = { "WarpedForest" }, biomes = { "WarpedForest" },
y_min = -31000, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_deco_max,
decoration = "mcl_crimson:warped_nylium", decoration = "mcl_crimson:warped_nylium",
flags = "all_floors", flags = "all_floors",
param2 = 0, param2 = 0,
@ -1681,16 +1709,29 @@ local function register_dimension_biomes()
_mcl_palette_index = 17, _mcl_palette_index = 17,
}) })
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand","mcl_blackstone:blackstone","mcl_nether:magma"},
sidelen = 16,
fill_ratio = 10,
biomes = { "BasaltDelta" },
y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_deco_max,
decoration = "mcl_blackstone:basalt",
flags = "all_floors",
param2 = 0,
})
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "mcl_blackstone:blackstone", ore = "mcl_blackstone:blackstone",
wherein = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_core:gravel","mcl_nether:soul_sand"}, wherein = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_core:gravel"},
clust_scarcity = 100, clust_scarcity = 100,
clust_num_ores = 400, clust_num_ores = 400,
clust_size = 20, clust_size = 20,
biomes = { "BasaltDelta" }, biomes = { "BasaltDelta" },
y_min = mcl_vars.mg_nether_min, y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max + 80, y_max = mcl_vars.mg_nether_deco_max,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 1, scale = 1,
@ -1703,19 +1744,6 @@ local function register_dimension_biomes()
} }
}) })
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:netherrack","mcl_nether:glowstone","mcl_blackstone:nether_gold","mcl_nether:quartz_ore","mcl_core:gravel","mcl_nether:soul_sand","mcl_blackstone:blackstone"},
sidelen = 16,
fill_ratio = 10,
biomes = { "BasaltDelta" },
y_min = -31000,
y_max = mcl_vars.mg_nether_max,
decoration = "mcl_blackstone:basalt",
flags = "all_floors",
param2 = 0,
})
--[[ THE END ]] --[[ THE END ]]
minetest.register_biome({ minetest.register_biome({
name = "End", name = "End",
@ -2342,7 +2370,7 @@ local function register_dimension_ores()
clust_scarcity = 26 * 26 * 26, clust_scarcity = 26 * 26 * 26,
clust_size = 5, clust_size = 5,
y_min = mcl_vars.mg_lava_nether_max + 10, y_min = mcl_vars.mg_lava_nether_max + 10,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_max - 13,
noise_threshold = 0.0, noise_threshold = 0.0,
noise_params = { noise_params = {
offset = 0.5, offset = 0.5,
@ -2405,11 +2433,24 @@ local function register_dimension_ores()
ore_type = "scatter", ore_type = "scatter",
ore = "mcl_nether:nether_lava_source", ore = "mcl_nether:nether_lava_source",
wherein = {"mcl_nether:netherrack", "mcl_core:stone"}, wherein = {"mcl_nether:netherrack", "mcl_core:stone"},
clust_scarcity = 13500, --rare
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max - 13,
})
local lava_biomes = {"BasaltDelta","Nether"}
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_nether:nether_lava_source",
wherein = {"mcl_nether:netherrack", "mcl_core:stone"},
clust_scarcity = 500, clust_scarcity = 500,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 1, clust_size = 1,
y_min = mcl_vars.mg_nether_min, biomes = lava_biomes,
y_max = mcl_vars.mg_lava_nether_max + 1, y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_lava_nether_max + 1,
}) })
minetest.register_ore({ minetest.register_ore({
@ -2419,6 +2460,7 @@ local function register_dimension_ores()
clust_scarcity = 1000, clust_scarcity = 1000,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 1, clust_size = 1,
biomes = lava_biomes,
y_min = mcl_vars.mg_lava_nether_max + 2, y_min = mcl_vars.mg_lava_nether_max + 2,
y_max = mcl_vars.mg_lava_nether_max + 12, y_max = mcl_vars.mg_lava_nether_max + 12,
}) })
@ -2430,6 +2472,7 @@ local function register_dimension_ores()
clust_scarcity = 2000, clust_scarcity = 2000,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 1, clust_size = 1,
biomes = lava_biomes,
y_min = mcl_vars.mg_lava_nether_max + 13, y_min = mcl_vars.mg_lava_nether_max + 13,
y_max = mcl_vars.mg_lava_nether_max + 48, y_max = mcl_vars.mg_lava_nether_max + 48,
}) })
@ -2440,8 +2483,9 @@ local function register_dimension_ores()
clust_scarcity = 3500, clust_scarcity = 3500,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 1, clust_size = 1,
biomes = lava_biomes,
y_min = mcl_vars.mg_lava_nether_max + 49, y_min = mcl_vars.mg_lava_nether_max + 49,
y_max = mcl_vars.mg_nether_max, y_max = mcl_vars.mg_nether_max - 13,
}) })
--[[ THE END ]] --[[ THE END ]]
@ -4743,17 +4787,6 @@ local function register_dimension_decorations()
flags = "all_floors", flags = "all_floors",
decoration = "mcl_mushrooms:mushroom_red", decoration = "mcl_mushrooms:mushroom_red",
}) })
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_nether:soul_sand"},
sidelen = 16,
fill_ratio = 0.0032,
biomes = {"Nether","SoulsandValley"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max - 1,
flags = "all_floors",
decoration = "mcl_nether:nether_wart",
})
-- WARPED FOREST -- WARPED FOREST
minetest.register_decoration({ minetest.register_decoration({
@ -4903,7 +4936,7 @@ local function register_dimension_decorations()
fill_ratio = 0.063, fill_ratio = 0.063,
biomes = {"CrimsonForest"}, biomes = {"CrimsonForest"},
y_min = mcl_vars.mg_lava_nether_max + 1, y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_max -5, y_max = mcl_vars.mg_nether_deco_max,
flags = "all_ceilings", flags = "all_ceilings",
height = 2, height = 2,
height_max = 8, height_max = 8,
@ -5000,6 +5033,7 @@ local function register_dimension_decorations()
}, },
biomes = {"BasaltDelta"}, biomes = {"BasaltDelta"},
y_min = mcl_vars.mg_lava_nether_max + 1, y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_deco_max - 50,
flags = "all_floors, all ceilings", flags = "all_floors, all ceilings",
}) })
minetest.register_decoration({ minetest.register_decoration({
@ -5020,6 +5054,19 @@ local function register_dimension_decorations()
}, },
biomes = {"BasaltDelta"}, biomes = {"BasaltDelta"},
y_min = mcl_vars.mg_lava_nether_max + 1, y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_deco_max - 15,
flags = "all_floors, all ceilings",
})
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_blackstone:basalt",
place_on = {"mcl_blackstone:basalt","mcl_nether:netherrack","mcl_blackstone:blackstone"},
sidelen = 80,
height_max = 3,
fill_ratio = 0.4,
biomes = {"BasaltDelta"},
y_min = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_vars.mg_nether_deco_max - 15,
flags = "all_floors, all ceilings", flags = "all_floors, all ceilings",
}) })
minetest.register_decoration({ minetest.register_decoration({

View File

@ -15,7 +15,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
local t1 = os.clock() 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} 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 if lvm > 0 then
local lvm_used, shadow, deco_used = false, false, false local lvm_used, shadow, deco_used, deco_table, ore_used, ore_table = false, false, false, false, false, false
local lb2 = {} -- param2 local lb2 = {} -- param2
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") 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 e1, e2 = {x=emin.x, y=emin.y, z=emin.z}, {x=emax.x, y=emax.y, z=emax.z}
@ -28,16 +28,23 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
for _, rec in ipairs(registered_generators) do for _, rec in ipairs(registered_generators) do
if rec.vf then if rec.vf then
local lvm_used0, shadow0, deco = rec.vf(vm, data, data2, e1, e2, area, p1, p2, blockseed) local lvm_used0, shadow0, deco, ore = rec.vf(vm, data, data2, e1, e2, area, p1, p2, blockseed)
if lvm_used0 then if lvm_used0 then
lvm_used = true lvm_used = true
end end
if shadow0 then if shadow0 then
shadow = true shadow = true
end end
if deco then if deco and type(deco) == "table" then
deco_table = deco
elseif deco then
deco_used = true deco_used = true
end end
if ore and type(ore) == "table" then
ore_table = ore
elseif deco then
ore_used = true
end
end end
end end
@ -47,9 +54,16 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
if param2 > 0 then if param2 > 0 then
vm:set_param2_data(data2) vm:set_param2_data(data2)
end end
if deco_used then if deco_table then
minetest.generate_decorations(vm,vector.new(minp.x,deco_table.min,minp.z),vector.new(maxp.x,deco_table.max,maxp.z))
elseif deco_used then
minetest.generate_decorations(vm) minetest.generate_decorations(vm)
end end
if ore_table then
minetest.generate_ores(vm,vector.new(minp.x,ore_table.min,minp.z),vector.new(maxp.x,ore_table.max,maxp.z))
elseif ore_used then
minetest.generate_ores(vm)
end
vm:calc_lighting(p1, p2, shadow) vm:calc_lighting(p1, p2, shadow)
vm:write_to_map() vm:write_to_map()
vm:update_liquids() vm:update_liquids()

View File

@ -104,6 +104,25 @@ if superflat then
minetest.set_mapgen_setting("mgflat_spflags", "nolakes,nohills", true) minetest.set_mapgen_setting("mgflat_spflags", "nolakes,nohills", true)
end end
if mg_name == "v7" then
minetest.set_mapgen_setting("mgv7_cavern_threshold", "0.20", true)
mg_flags.caverns = true
elseif mg_name == "valleys" then
minetest.set_mapgen_setting("mgvalleys_cavern_threshold", "0.20", true)
mg_flags.caverns = true
elseif mg_name == "carpathian" then
minetest.set_mapgen_setting("mgcarpathian_cavern_threshold", "0.20", true)
mg_flags.caverns = true
elseif mg_name == "v5" then
minetest.set_mapgen_setting("mgv5_cavern_threshold", "0.20", true)
mg_flags.caverns = true
elseif mg_name == "fractal" then
minetest.set_mapgen_setting("mgfractal_cavern_threshold", "0.20", true)
mg_flags.caverns = true
end
local mg_flags_str = "" local mg_flags_str = ""
for k,v in pairs(mg_flags) do for k,v in pairs(mg_flags) do
if v == false then if v == false then
@ -313,8 +332,16 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, minp, maxp, lvm_used, pr) lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, minp, maxp, lvm_used, pr)
end end
end end
local deco = false
return lvm_used, lvm_used local ores = false
if minp.y > mcl_vars.mg_nether_deco_max - 64 and maxp.y < mcl_vars.mg_nether_max + 128 then
deco = {min=mcl_vars.mg_nether_deco_max,max=mcl_vars.mg_nether_max}
end
if minp.y < mcl_vars.mg_nether_min + 10 or maxp.y < mcl_vars.mg_nether_min + 60 then
deco = {min=mcl_vars.mg_nether_min - 10,max=mcl_vars.mg_nether_min + 20}
ores = {min=mcl_vars.mg_nether_min - 10,max=mcl_vars.mg_nether_min + 20}
end
return lvm_used, lvm_used, deco, ores
end end
local function block_fixes(vm, data, data2, emin, emax, area, minp, maxp, blockseed) local function block_fixes(vm, data, data2, emin, emax, area, minp, maxp, blockseed)

View File

@ -1,29 +1,212 @@
local modname = minetest.get_current_modname() local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
mcl_structures.register_structure("nether_outpost",{ mcl_structures.register_structure("nether_outpost",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil"}, place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"},
noise_params = { fill_ratio = 0.01,
offset = 0, chunk_probability = 900,
scale = 0.00022,
spread = {x = 250, y = 250, z = 250},
seed = 333,
octaves = 1,
persist = 0.0001,
flags = "absvalue",
},
flags = "all_floors", flags = "all_floors",
biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"}, biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"},
sidelen = 15, sidelen = 24,
solid_ground = true, solid_ground = true,
make_foundation = true, make_foundation = true,
y_min = mcl_vars.mg_lava_nether_max - 1, y_min = mcl_vars.mg_lava_nether_max - 1,
y_max = mcl_vars.mg_nether_max - 30, y_max = mcl_vars.mg_nether_max - 30,
filenames = { modpath.."/schematics/nether_outpost.mts" }, filenames = { modpath.."/schematics/mcl_nether_fortresses_nether_outpost.mts" },
y_offset = 0, y_offset = 0,
after_place = function(pos) after_place = function(pos)
local sp = minetest.find_nodes_in_area(pos,vector.offset(pos,0,20,0),{"mcl_mobspawners:spawner"}) local sp = minetest.find_nodes_in_area(pos,vector.offset(pos,0,20,0),{"mcl_mobspawners:spawner"})
if not sp[1] then return end if not sp[1] then return end
mcl_mobspawners.setup_spawner(sp[1], "mobs_mc:blaze", 0, minetest.LIGHT_MAX+1, 10, 3, -1) mcl_mobspawners.setup_spawner(sp[1], "mobs_mc:blaze", 0, minetest.LIGHT_MAX+1, 10, 8, 0)
end end
}) })
local nbridges = {
modpath.."/schematics/mcl_nether_fortresses_nether_bridge_1.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bridge_2.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bridge_3.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bridge_4.mts",
}
mcl_structures.register_structure("nether_bridge",{
place_on = {"mcl_nether:nether_lava_source","mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand","mcl_core:bedrock"},
fill_ratio = 0.01,
chunk_probability = 500,
flags = "all_floors",
sidelen = 38,
solid_ground = false,
make_foundation = false,
y_min = mcl_vars.mg_nether_min - 4,
y_max = mcl_vars.mg_lava_nether_max - 20,
filenames = nbridges,
y_offset = function(pr) return pr:next(15,20) end,
after_place = function(pos,def,pr)
local p1 = vector.offset(pos,-14,0,-14)
local p2 = vector.offset(pos,14,24,14)
mcl_structures.spawn_mobs("mobs_mc:witherskeleton",{"mcl_blackstone:blackstone_chiseled_polished"},p1,p2,pr,5)
end
})
mcl_structures.register_structure("nether_outpost_with_bridges",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand","mcl_nether:nether_lava_source"},
fill_ratio = 0.01,
chunk_probability = 1300,
flags = "all_floors",
biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"},
sidelen = 24,
solid_ground = true,
make_foundation = true,
y_min = mcl_vars.mg_lava_nether_max - 1,
y_max = mcl_vars.mg_nether_max - 30,
filenames = { modpath.."/schematics/mcl_nether_fortresses_nether_outpost.mts" },
daughters = {{
files = { nbridges[1] },
pos = vector.new(0,-2,-24),
rot = 180,
},
{
files = { nbridges[1] },
pos = vector.new(0,-2,24),
rot = 0,
},
{
files = { nbridges[1] },
pos = vector.new(-24,-2,0),
rot = 270,
},
{
files = { nbridges[1] },
pos = vector.new(24,-2,0),
rot = 90,
},
},
after_place = function(pos,def,pr)
local sp = minetest.find_nodes_in_area(pos,vector.offset(pos,0,20,0),{"mcl_mobspawners:spawner"})
if not sp[1] then return end
mcl_mobspawners.setup_spawner(sp[1], "mobs_mc:blaze", 0, minetest.LIGHT_MAX+1, 10, 8, 0)
local legs = minetest.find_nodes_in_area(vector.offset(pos,-45,-2,-45),vector.offset(pos,45,0,45), "mcl_nether:nether_brick")
local bricks = {}
for _,leg in pairs(legs) do
while minetest.get_item_group(mcl_vars.get_node(vector.offset(leg,0,-1,0), true, 333333).name, "solid") == 0 do
leg = vector.offset(leg,0,-1,0)
table.insert(bricks,leg)
end
end
minetest.bulk_set_node(bricks, {name = "mcl_nether:nether_brick", param2 = 2})
local p1 = vector.offset(pos,-45,13,-45)
local p2 = vector.offset(pos,45,13,45)
mcl_structures.spawn_mobs("mobs_mc:witherskeleton",{"mcl_blackstone:blackstone_chiseled_polished"},p1,p2,pr,5)
end
},true)
mcl_structures.register_structure_spawn({
name = "mobs_mc:witherskeleton",
y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_nether_max,
chance = 15,
interval = 60,
limit = 4,
spawnon = { "mcl_blackstone:blackstone_chiseled_polished" },
})
mcl_structures.register_structure("nether_bulwark",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil","mcl_blackstone:blackstone","mcl_nether:soul_sand"},
fill_ratio = 0.01,
chunk_probability = 900,
flags = "all_floors",
biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest"},
sidelen = 36,
solid_ground = true,
make_foundation = true,
y_min = mcl_vars.mg_lava_nether_max - 1,
y_max = mcl_vars.mg_nether_max - 30,
filenames = {
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_1.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_2.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_3.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_4.mts",
},
daughters = {{
files = {
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_interior_1.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_interior_2.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_interior_3.mts",
modpath.."/schematics/mcl_nether_fortresses_nether_bulwark_interior_4.mts",
},
pos = vector.new(0,0,0),
},
},
y_offset = 0,
construct_nodes = {"group:wall"},
after_place = function(pos,def,pr)
local p1 = vector.offset(pos,-14,0,-14)
local p2 = vector.offset(pos,14,24,14)
mcl_structures.spawn_mobs("mobs_mc:piglin",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr,5)
mcl_structures.spawn_mobs("mobs_mc:piglin_brute",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr)
mcl_structures.spawn_mobs("mobs_mc:hoglin",{"mcl_blackstone:nether_gold"},p1,p2,pr,4)
end,
loot = {
["mcl_chests:chest_small" ] ={
{
stacks_min = 1,
stacks_max = 2,
items = {
--{ itemstring = "FIXME:spectral_arrow", weight = 1, amount_min = 10, amount_max=28 },
{ itemstring = "mcl_blackstone:blackstone_gilded", weight = 1, amount_min = 8, amount_max=12 },
{ itemstring = "mcl_core:iron_ingot", weight = 1, amount_min = 4, amount_max=9 },
{ itemstring = "mcl_core:gold_ingot", weight = 1, amount_min = 4, amount_max=9 },
{ itemstring = "mcl_core:crying_obsidian", weight = 1, amount_min = 3, amount_max=8 },
{ itemstring = "mcl_bows:crossbow", weight = 1, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstring = "mcl_core:goldblock", weight = 1, },
{ itemstring = "mcl_tools:sword_gold", weight = 1, },
{ itemstring = "mcl_tools:axe_gold", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:helmet_gold", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:chestplate_gold", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:leggings_gold", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
{ itemstring = "mcl_armor:boots_gold", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
}
},
{
stacks_min = 2,
stacks_max = 4,
items = {
{ itemstring = "mcl_bows:arrow", weight = 4, amount_min = 5, amount_max=17 },
{ itemstring = "mcl_mobitems:string", weight = 4, amount_min = 1, amount_max=6 },
{ itemstring = "mcl_core:iron_nugget", weight = 1, amount_min = 2, amount_max = 6 },
{ itemstring = "mcl_core:gold_nugget", weight = 1, amount_min = 2, amount_max = 6 },
{ itemstring = "mcl_mobitems:leather", weight = 1, amount_min = 1, amount_max = 3 },
}
},
{
stacks_min = 1,
stacks_max = 1,
items = {
{ itemstring = "mcl_compass:lodestone" },
}
}}
},
})
mcl_structures.register_structure_spawn({
name = "mobs_mc:piglin",
y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_nether_max,
chance = 10,
interval = 60,
limit = 9,
spawnon = {"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},
})
mcl_structures.register_structure_spawn({
name = "mobs_mc:piglin_brute",
y_min = mcl_vars.mg_nether_min,
y_max = mcl_vars.mg_nether_max,
chance = 20,
interval = 60,
limit = 4,
spawnon = {"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},
})

View File

@ -1,11 +1,18 @@
mcl_structures.registered_structures = {} mcl_structures.registered_structures = {}
local place_queue = {}
local disabled_structures = minetest.settings:get("mcl_disabled_structures") 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 peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local mob_cap_player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75
local mob_cap_animal = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 10
local logging = minetest.settings:get_bool("mcl_logging_structures",true) local logging = minetest.settings:get_bool("mcl_logging_structures",true)
local mg_name = minetest.get_mapgen_setting("mg_name")
local rotations = { local rotations = {
"0", "0",
"90", "90",
@ -26,6 +33,9 @@ local function ecb_place(blockpos, action, calls_remaining, param)
end end
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param) function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
if type(schematic) ~= "table" and not mcl_util.file_exists(schematic) then
minetest.log("warning","[mcl_structures] schematic file "..tostring(schematic).." does not exist.")
return end
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")() local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
if s and s.size then if s and s.size then
local x, z = s.size.x, s.size.z local x, z = s.size.x, s.size.z
@ -185,7 +195,7 @@ local function foundation(ground_p1,ground_p2,pos,sidelen)
local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name
local node_dust = nil local node_dust = nil
if minetest.get_mapgen_setting("mg_name") ~= "v6" then if mg_name ~= "v6" then
local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]
--minetest.log(dump(b.node_top)) --minetest.log(dump(b.node_top))
if b then if b then
@ -206,7 +216,33 @@ local function foundation(ground_p1,ground_p2,pos,sidelen)
minetest.bulk_set_node(stone,{name=node_stone}) minetest.bulk_set_node(stone,{name=node_stone})
end end
function mcl_structures.place_structure(pos, def, pr, blockseed,rot) local function process_queue()
if #place_queue < 1 then return end
local s = table.remove(place_queue)
mcl_structures.place_schematic(s.pos, s.file, s.rot, nil, true, "place_center_x,place_center_z",function(s)
if s.after_place then
s.after_place(s.pos,s.def,s.pr)
end
end,s.pr)
minetest.after(0.5,process_queue)
end
function mcl_structures.spawn_mobs(mob,spawnon,p1,p2,pr,n)
n = n or 1
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
table.shuffle(sp)
for i,node in pairs(sp) do
if not peaceful and i <= n then
local pos = vector.offset(node,0,1,0)
if pos then
minetest.add_entity(pos,mob)
end
end
minetest.get_meta(node):set_string("spawnblock","yes")
end
end
function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
if not def then return end if not def then return end
if not rot then rot = "random" end if not rot then rot = "random" end
local log_enabled = logging and not def.terrain_feature local log_enabled = logging and not def.terrain_feature
@ -244,12 +280,31 @@ function mcl_structures.place_structure(pos, def, pr, blockseed,rot)
local r = pr:next(1,#def.filenames) local r = pr:next(1,#def.filenames)
local file = def.filenames[r] local file = def.filenames[r]
if file then if file then
local rot = rotations[pr:next(1,#rotations)]
local ap = function(pos,def,pr,blockseed) end local ap = function(pos,def,pr,blockseed) end
if def.after_place then ap = def.after_place end
mcl_structures.place_schematic(pp, file, rot, def.replacements, true, "place_center_x,place_center_z",function(p1, p2, size, rotation) if def.daughters then
if def.loot then generate_loot(pp,def,pr,blockseed) end ap = function(pos,def,pr,blockseed)
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end for _,d in pairs(def.daughters) do
local p = vector.add(pos,d.pos)
local rot = d.rot or 0
mcl_structures.place_schematic(p, d.files[pr:next(1,#d.files)], rot, nil, true, "place_center_x,place_center_z",function()
if def.loot then generate_loot(pp,def,pr,blockseed) end
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
if def.after_place then
def.after_place(pos,def,pr)
end
end,pr)
end
end
elseif def.after_place then
ap = def.after_place
end
mcl_structures.place_schematic(pp, file, rot, def.replacements, true, "place_center_x,place_center_z",function(p1, p2, size, rotation)
if not def.daughters then
if def.loot then generate_loot(pp,def,pr,blockseed) end
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
end
return ap(pp,def,pr,blockseed,p1,p2,size,rotation) return ap(pp,def,pr,blockseed,p1,p2,size,rotation)
end,pr) end,pr)
if log_enabled then if log_enabled then
@ -313,6 +368,35 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
mcl_structures.registered_structures[name] = def mcl_structures.registered_structures[name] = def
end end
local structure_spawns = {}
function mcl_structures.register_structure_spawn(def)
--name,y_min,y_max,spawnon,biomes,chance,interval,limit
minetest.register_abm({
label = "Spawn "..def.name,
nodenames = def.spawnon,
min_y = def.y_min or -31000,
max_y = def.y_max or 31000,
interval = def.interval or 60,
chance = def.chance or 5,
action = function(pos, node, active_object_count, active_object_count_wider)
local limit = def.limit or 7
if active_object_count_wider > limit + mob_cap_animal then return end
if active_object_count_wider > mob_cap_player then return end
local p = vector.offset(pos,0,1,0)
if minetest.get_node(p).name ~= "air" then return end
if minetest.get_meta(pos):get_string("spawnblock") == "" then return end
if mg_name ~= "v6" and mg_name ~= "singlenode" and def.biomes then
if table.indexof(def.biomes,minetest.get_biome_name(minetest.get_biome_data(p).biome)) == -1 then
return
end
end
local mobdef = minetest.registered_entities[def.name]
if mobdef.can_spawn and not mobdef.can_spawn(p) then return end
minetest.add_entity(p,def.name)
end,
})
end
--lbm for secondary structures (structblock included in base structure) --lbm for secondary structures (structblock included in base structure)
minetest.register_lbm({ minetest.register_lbm({
name = "mcl_structures:struct_lbm", name = "mcl_structures:struct_lbm",

View File

@ -2,14 +2,13 @@ local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname) local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local spawnon = {"mcl_end:purpur_block"}
local function spawn_shulkers(pos,def,pr) 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"}) local p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2)
if nn and #nn > 0 then local p2 = vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2)
table.shuffle(nn) mcl_structures.spawn_mobs("mobs_mc:shulker",spawnon,p1,p2,pr,1)
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"}) local guard = minetest.find_node_near(pos,def.sidelen,{"mcl_itemframes:item_frame"})
if guard then if guard then
minetest.add_entity(vector.offset(guard,0,-1.5,0),"mobs_mc:shulker") minetest.add_entity(vector.offset(guard,0,-1.5,0),"mobs_mc:shulker")
@ -133,3 +132,13 @@ mcl_structures.register_structure("end_boat",{
}} }}
} }
}) })
mcl_structures.register_structure_spawn({
name = "mobs_mc:shulker",
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max,
chance = 10,
interval = 60,
limit = 6,
spawnon = spawnon,
})

View File

@ -14,6 +14,24 @@ function mcl_structures.generate_igloo_top(pos, pr)
end), rotation end), rotation
end end
local function spawn_mobs(p1,p2,vi,zv)
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"})
if #mc == 2 then
local vp = mc[1]
local zp = mc[2]
if not vi and zv and zv:get_pos() and vector.distance(mc[1],zv:get_pos()) < 2 then
vp = mc[2]
elseif not zv and vi and vi:get_pos() and vector.distance(mc[2],vi:get_pos()) < 2 then
zp = mc[1]
elseif zv and vi then
return
end
vi = minetest.add_entity(vector.offset(mc[1],0,1,0),"mobs_mc:villager")
zv = minetest.add_entity(vector.offset(mc[2],0,1,0),"mobs_mc:villager_zombie")
minetest.after(1,spawn_mobs,p1,p2,vi,zv)
end
end
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr) function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
-- TODO: Add monster eggs -- TODO: Add monster eggs
local path = modpath.."/schematics/mcl_structures_igloo_basement.mts" local path = modpath.."/schematics/mcl_structures_igloo_basement.mts"
@ -22,12 +40,7 @@ function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
local p2 = vector.offset(pos,5,5,5) local p2 = vector.offset(pos,5,5,5)
mcl_structures.fill_chests(p1,p2,loot,pr) mcl_structures.fill_chests(p1,p2,loot,pr)
mcl_structures.construct_nodes(p1,p2,{"mcl_brewing:stand_000","mcl_books:bookshelf"}) mcl_structures.construct_nodes(p1,p2,{"mcl_brewing:stand_000","mcl_books:bookshelf"})
local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"}) spawn_mobs(p1,p2)
if #mc == 2 then
table.shuffle(mc)
minetest.add_entity(vector.offset(mc[1],0,1,0),"mobs_mc:villager")
minetest.add_entity(vector.offset(mc[2],0,1,0),"mobs_mc:villager_zombie")
end
end, pr) end, pr)
end end

View File

@ -3,6 +3,8 @@ local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false) local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local spawnon = {"mcl_core:stripped_oak"}
mcl_structures.register_structure("pillager_outpost",{ mcl_structures.register_structure("pillager_outpost",{
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"}, place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:sand"},
fill_ratio = 0.01, fill_ratio = 0.01,
@ -58,27 +60,28 @@ mcl_structures.register_structure("pillager_outpost",{
after_place = function(p,def,pr) after_place = function(p,def,pr)
local p1 = vector.offset(p,-7,0,-7) local p1 = vector.offset(p,-7,0,-7)
local p2 = vector.offset(p,7,14,7) local p2 = vector.offset(p,7,14,7)
local spawnon = {"mcl_core:stripped_oak"} mcl_structures.spawn_mobs("mobs_mc:evoker",spawnon,p1,p2,pr,1)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) mcl_structures.spawn_mobs("mobs_mc:pillager",spawnon,p1,p2,pr,5)
for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do mcl_structures.construct_nodes(p1,p2,{"group:wall"})
local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")]
if def and def.on_construct then
def.on_construct(n)
end
end
if not peaceful then
if sp and #sp > 0 then
for i=1,5 do
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
if pos then
minetest.add_entity(pos,"mobs_mc:pillager")
end
end
local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0)
if pos then
minetest.add_entity(pos,"mobs_mc:evoker")
end
end
end
end end
}) })
mcl_structures.register_structure_spawn({
name = "mobs_mc:pillager",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
chance = 10,
interval = 60,
limit = 9,
spawnon = spawnon,
})
mcl_structures.register_structure_spawn({
name = "mobs_mc:evoker",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
chance = 100,
interval = 60,
limit = 4,
spawnon = spawnon,
})

View File

@ -3,6 +3,8 @@ local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname) local modpath = minetest.get_modpath(modname)
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false) local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local spawnon = {"mcl_deepslate:deepslate","mcl_core:birchwood","mcl_wool:red_carpet","mcl_wool:brown_carpet"}
mcl_structures.register_structure("woodland_cabin",{ mcl_structures.register_structure("woodland_cabin",{
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"},
fill_ratio = 0.01, fill_ratio = 0.01,
@ -20,28 +22,11 @@ mcl_structures.register_structure("woodland_cabin",{
}, },
construct_nodes = {"mcl_barrels:barrel_closed"}, 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 p1=vector.offset(p,-def.sidelen,-1,-def.sidelen) local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen) local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) mcl_structures.spawn_mobs("mobs_mc:vindicator",spawnon,p1,p2,pr,5)
if not peaceful then mcl_structures.spawn_mobs("mobs_mc:evoker",spawnon,p1,p2,pr,1)
if sp and #sp > 0 then mcl_structures.spawn_mobs("mobs_mc:parrot",{"mcl_heads:wither_skeleton"},p1,p2,pr,1)
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mobs_mc:vindicator")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mobs_mc:evoker")
end
end
end
local parrot = minetest.find_node_near(p,25,{"mcl_heads:wither_skeleton"})
if parrot then
minetest.add_entity(parrot,"mobs_mc:parrot")
end
end, end,
loot = { loot = {
["mcl_chests:chest_small" ] ={{ ["mcl_chests:chest_small" ] ={{
@ -82,3 +67,23 @@ mcl_structures.register_structure("woodland_cabin",{
}} }}
} }
}) })
mcl_structures.register_structure_spawn({
name = "mobs_mc:vindicator",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
chance = 10,
interval = 60,
limit = 6,
spawnon = spawnon,
})
mcl_structures.register_structure_spawn({
name = "mobs_mc:evoker",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_max,
chance = 50,
interval = 60,
limit = 6,
spawnon = spawnon,
})