diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 2673da92d0..e988a7c731 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -18,8 +18,9 @@ local adjacents = { 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 + 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) diff --git a/mods/ITEMS/mcl_itemframes/init.lua b/mods/ITEMS/mcl_itemframes/init.lua index eac5b066b6..6fda0176e8 100644 --- a/mods/ITEMS/mcl_itemframes/init.lua +++ b/mods/ITEMS/mcl_itemframes/init.lua @@ -1,3 +1,4 @@ +mcl_itemframes = {} local S = minetest.get_translator(minetest.get_current_modname()) local VISUAL_SIZE = 0.3 @@ -132,6 +133,7 @@ local update_item_entity = function(pos, node, param2) end end end +mcl_itemframes.update_item_entity = update_item_entity local drop_item = function(pos, node, meta, clicker) local cname = "" diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 443dfb5840..4995cccee5 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -5,7 +5,7 @@ if disabled_structures then disabled_structures = disabled_structures:split(",") else disabled_structures = {} end function mcl_structures.is_disabled(structname) - if table.indexof(disabled_structures,structname) ~= -1 then return true end + return table.indexof(disabled_structures,structname) ~= -1 end function mcl_structures.fill_chests(p1,p2,loot,pr) @@ -31,10 +31,7 @@ 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 - local def = minetest.registered_nodes[minetest.get_node(p).name] - if def and def.on_construct then - def.on_construct(p) - end + mcl_structures.init_node_construct(p) end end @@ -187,8 +184,8 @@ function mcl_structures.place_structure(pos, def, pr, blockseed) end return true end - elseif def.place_func and def.place_func(pos,def,pr,blockseed) then - if not def.after_place or ( def.after_place and def.after_place(pos,def,pr,blockseed) ) then + elseif def.place_func and def.place_func(pp,def,pr,blockseed) then + if not def.after_place or ( def.after_place and def.after_place(pp,def,pr,blockseed) ) then if def.loot then generate_loot(pp,def,pr,blockseed) end if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end if logging then @@ -231,12 +228,12 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) --catching of gennotify happens in mcl_mapgen_core + end) end end diff --git a/mods/MAPGEN/mcl_structures/end_city.lua b/mods/MAPGEN/mcl_structures/end_city.lua index 11e5b6fbf1..bf937c7f7d 100644 --- a/mods/MAPGEN/mcl_structures/end_city.lua +++ b/mods/MAPGEN/mcl_structures/end_city.lua @@ -3,13 +3,17 @@ 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),def.construct_nodes) + 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 - local n = pr:next(1,#nn) - for i = 1,n do - minetest.add_entity(vector.offset(nn[i],0,1,0),"mobs_mc:shulker") + 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",{ @@ -25,9 +29,24 @@ mcl_structures.register_structure("end_shipwreck",{ filenames = { modpath.."/schematics/mcl_structures_end_shipwreck_1.mts", }, - construct_nodes = {"mcl_chests:ender_chest_small","mcl_chests:ender_chest","mcl_brewing:stand_000"}, - 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"}, + 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, @@ -62,7 +81,6 @@ mcl_structures.register_structure("end_shipwreck",{ { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, - { itemstring = "mcl_elytra:elytra", weight = 1, }, } }} } @@ -82,7 +100,7 @@ mcl_structures.register_structure("end_boat",{ 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"}, + 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, diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_shipwreck_1.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_shipwreck_1.mts index 685c1f4fd8..5daad2f3d0 100644 Binary files a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_shipwreck_1.mts and b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_shipwreck_1.mts differ