From 62f353d54f7a34aef76fad338ca151b81ceb0a52 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 28 Oct 2022 00:07:23 +0200 Subject: [PATCH] Spawn hoglins in stable bullwarks --- mods/MAPGEN/mcl_nether_fortresses/init.lua | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/mods/MAPGEN/mcl_nether_fortresses/init.lua b/mods/MAPGEN/mcl_nether_fortresses/init.lua index 57d9dbd8d1..3595719ade 100644 --- a/mods/MAPGEN/mcl_nether_fortresses/init.lua +++ b/mods/MAPGEN/mcl_nether_fortresses/init.lua @@ -22,13 +22,26 @@ mcl_structures.register_structure("nether_outpost",{ mcl_mobspawners.setup_spawner(sp[1], "mobs_mc:blaze", 0, minetest.LIGHT_MAX+1, 10, 8, 0) end }) + +local function spawn_mobs(mob,spawnon,p1,p2,pr,n) + n = n or 1 + local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon) + if sp and #sp > 0 then + for i=1,n do + local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0) + if pos then + minetest.add_entity(pos,mob) + end + end + end +end 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 = 600, flags = "all_floors", biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest"}, - sidelen = 32, + sidelen = 36, solid_ground = true, make_foundation = true, y_min = mcl_vars.mg_lava_nether_max - 1, @@ -50,21 +63,11 @@ mcl_structures.register_structure("nether_bulwark",{ construct_nodes = {"group:wall"}, after_place = function(pos,def,pr) if not peaceful then - local p1 = vector.offset(pos,-10,0,-10) - local p2 = vector.offset(pos,10,24,10) - local sp = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_blackstone:blackstone_brick_polished"}) - 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:piglin") - end - end - local pos = vector.offset(sp[pr:next(1,#sp)],0,1,0) - if pos then - minetest.add_entity(pos,"mobs_mc:piglin_brute") - end - end + local p1 = vector.offset(pos,-14,0,-14) + local p2 = vector.offset(pos,14,24,14) + spawn_mobs("mobs_mc:piglin",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr,5) + spawn_mobs("mobs_mc:piglin_brute",{"mcl_blackstone:blackstone_brick_polished","mcl_stairs:slab_blackstone_polished"},p1,p2,pr) + spawn_mobs("mobs_mc:hoglin",{"mcl_blackstone:nether_gold"},p1,p2,pr,4) end end, loot = {