Merge pull request 'spawn-egg-crash-fix' (#3492) from GuyLiner/MineClone2:spawn-egg-crash-fix into master

Reviewed-on: MineClone2/MineClone2#3492
This commit is contained in:
ancientmarinerdev 2023-03-04 00:34:45 +00:00
commit 48fa2608ed
8 changed files with 23 additions and 11 deletions

View File

@ -502,13 +502,20 @@ function mcl_mobs:mob_light_lvl(mob_name, dimension)
["max_light"] = spawn_dictionary[i].max_light
}
end
mob_dimension = spawn_dictionary_consolidated[mob_name][dimension]
mob_dimension_default = spawn_dictionary_consolidated[mob_name]["overworld"]
if spawn_dictionary_consolidated[mob_name] == mob_name and mob_dimension ~= nil then
return mob_dimension.min_light, mob_dimension.max_light
else
return mob_dimension_default.min_light, mob_dimension_default.max_light
end
if spawn_dictionary_consolidated[mob_name] ~= nil then
mob_dimension = spawn_dictionary_consolidated[mob_name][dimension]
mob_dimension_default = spawn_dictionary_consolidated[mob_name]["overworld"]
if spawn_dictionary_consolidated[mob_name] == mob_name and mob_dimension ~= nil then
return mob_dimension.min_light, mob_dimension.max_light
else
return mob_dimension_default.min_light, mob_dimension_default.max_light
end
else
minetest.log("error", "There are no light levels for this mob")
--default light values if mob's light values don't exist in either dictionary
return 0, minetest.LIGHT_MAX+1
end
end
end

View File

@ -102,6 +102,6 @@ mcl_mobs.register_mob("mobs_mc:guardian", {
-- Spawning disabled due to size issues
-- TODO: Re-enable spawning
--mcl_mobs:spawn_specific("mobs_mc:guardian", { "mcl_core:water_source", "mclx_core:river_water_source" }, { "mcl_core:water_source", "mclx_core:river_water_source" }, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mcl_vars.mg_overworld_min, mobs_mc.water_level - 10)
mcl_mobs:non_spawn_specific("mobs_mc:guardian","overworld",0,minetest.LIGHT_MAX+1)
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:guardian", S("Guardian"), "#5a8272", "#f17d31", 0)

View File

@ -113,5 +113,4 @@ mcl_mobs.register_mob("mobs_mc:guardian_elder", {
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "#ceccba", "#747693", 0)
mcl_mobs:non_spawn_specific("mobs_mc:guardian_elder","overworld",0,minetest.LIGHT_MAX+1)

View File

@ -646,3 +646,5 @@ mcl_mobs.register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "#68684f",
--mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "#2a5a37", "#84d080", 0)
mcl_mobs.register_egg("mobs_mc:donkey", S("Donkey"), "#534539", "#867566", 0)
mcl_mobs.register_egg("mobs_mc:mule", S("Mule"), "#1b0200", "#51331d", 0)
mcl_mobs:non_spawn_specific("mobs_mc:mule","overworld",9,minetest.LIGHT_MAX+1)
mcl_mobs:non_spawn_specific("mobs_mc:skeleton_horse","overworld",9,minetest.LIGHT_MAX+1)

View File

@ -319,3 +319,4 @@ mcl_vars.mg_nether_max)
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:piglin", S("Piglin"), "#7b4a17","#d5c381", 0)
mcl_mobs.register_egg("mobs_mc:piglin_brute", S("Piglin Brute"), "#562b0c","#ddc89d", 0)
mcl_mobs:non_spawn_specific("mobs_mc:piglin_brute","overworld",0,7)

View File

@ -217,3 +217,4 @@ mcl_mobs.register_egg("mobs_mc:rabbit", S("Rabbit"), "#995f40", "#734831", 0)
-- Note: This spawn egg does not exist in Minecraft
mcl_mobs.register_egg("mobs_mc:killer_bunny", S("Killer Bunny"), "#f2f2f2", "#ff0000", 0)
mcl_mobs:non_spawn_specific("mobs_mc:killer_bunny","overworld",9,minetest.LIGHT_MAX+1)

View File

@ -289,6 +289,8 @@ mcl_mobs:spawn_specific(
mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max)
mcl_mobs:non_spawn_specific("mobs_mc:cave_spider","overworld",0,7)
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:spider", S("Spider"), "#342d26", "#a80e0e", 0)
mcl_mobs.register_egg("mobs_mc:cave_spider", S("Cave Spider"), "#0c424e", "#a80e0e", 0)

View File

@ -246,4 +246,4 @@ mcl_mobs:spawn_setup({
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:strider", S("Strider"), "#000000", "#FF0000", 0)
mcl_mobs:non_spawn_specific("mobs_mc:strider","nether",0,minetest.LIGHT_MAX+1)
mcl_mobs:non_spawn_specific("mobs_mc:strider","overworld",0,minetest.LIGHT_MAX+1)