From a348909ba3cb8d274e313e9f6fff56d933c3dda9 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 6 Apr 2021 12:50:36 +0200 Subject: [PATCH 1/7] Enderdragon: Proper Egg and XP spawning --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 16 ++++++---------- mods/ITEMS/mcl_end/end_crystal.lua | 3 +-- mods/MAPGEN/mcl_structures/init.lua | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index e62b0d16b9..ddaea360f8 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -50,8 +50,8 @@ mobs:register_mob("mobs_mc:enderdragon", { arrow = "mobs_mc:dragon_fireball", shoot_interval = 0.5, shoot_offset = -1.0, - xp_min = 12000, - xp_max = 12000, + xp_min = 500, + xp_max = 500, animation = { fly_speed = 8, stand_speed = 8, stand_start = 0, stand_end = 20, @@ -59,15 +59,11 @@ mobs:register_mob("mobs_mc:enderdragon", { run_start = 0, run_end = 20, }, ignores_nametag = true, - on_die = function(self, own_pos) - if self._egg_spawn_pos then - local pos = minetest.string_to_pos(self._egg_spawn_pos) - --if minetest.get_node(pos).buildable_to then - minetest.set_node(pos, {name = mobs_mc.items.dragon_egg}) - return - --end + on_die = function(self, pos) + if not self._respawned then + mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 + minetest.set_node(self._portal_pos and minetest.string_to_pos(self._portal_pos) or vector.add(mcl_vars.mg_end_platform_pos, vector.new(-27, 2, 0)), {name = mobs_mc.items.dragon_egg}) end - minetest.add_item(own_pos, mobs_mc.items.dragon_egg) end, fire_resistant = true, }) diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index d089c3cdf7..8fcf67a1d6 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -58,8 +58,7 @@ local function spawn_crystal(pos) for _, crystal in pairs(crystals) do crystal_explode(crystal) end - local dragon = minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon") - dragon:get_luaentity()._egg_spawn_pos = minetest.pos_to_string(vector.add(portal_center, {x = 0, y = 4, z = 0})) + minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon"):get_luaentity()._respawned = true end minetest.register_entity("mcl_end:crystal", { diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 6a7f44dfbc..4294215a91 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -313,7 +313,7 @@ mcl_structures.generate_fossil = function(pos, rotation, pr) end mcl_structures.generate_end_exit_portal = function(pos, rot) - minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon") + minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = minetest.pos_to_string(vector.add(pos, vector.new(3, 5, 3))) local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts" return mcl_structures.place_schematic(pos, path, rot or "0", nil, true) end From 055c406d7a02b01724eb0f952e9ab4f5d0a4c6f5 Mon Sep 17 00:00:00 2001 From: Doloment Date: Tue, 6 Apr 2021 18:57:06 +0700 Subject: [PATCH 2/7] Fix chest entity textures (trapped chests were lighter) --- .../mcl_chests/textures/mcl_chests_normal.png | Bin 689 -> 672 bytes .../textures/mcl_chests_normal_double.png | Bin 1031 -> 961 bytes .../mcl_chests/textures/mcl_chests_trapped.png | Bin 1209 -> 674 bytes .../textures/mcl_chests_trapped_double.png | Bin 2011 -> 965 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ITEMS/mcl_chests/textures/mcl_chests_normal.png b/mods/IT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6w_aI@x*(kZU7tH*8pNXO`a*5_aqx(%+w74HtRR*GewCx z`JEfzqj<*CHlT-%_Vh7*Q+AQ-w6f>7<$wP>%tnPmyU5riW86ggsvO9eiYf=H*d$|{ z%&~cO^U5*i`_q?K*O)%<<@NQpcs2mvzC6dr)^ofsugM%6N&eXIB#ALUPP{`EQ~A8E z!1&O-Q|ld)*JO^ZPojJNI_u9EAf_q?o)!p;+m|5Ear%(1yJxCl?kg)PpL_e;rZGRKw+Lw-jr-1~Tv zb18XE=Ga`EMR>A^@9Bf|$?SPe=6@U7X0utE(zz0)b0tdWN|er(D4i=&I#;4}u0-iv ziPE_erE?`p=Sq~$l_;GnQ94(mbSkby>0F7@xe}#wMxM>8Vl(nQc6Id=*tZtL<|9;J P00000NkvXXu0mjf?&D5S diff --git a/mods/ITEMS/mcl_chests/textures/mcl_chests_trapped_double.png b/mods/ITEMS/mcl_chests/textures/mcl_chests_trapped_double.png index 95f768f97c0e7f1243b73df472b10174c7e69246..88ff45825f872490246c2b5eb81f18bb907d887b 100644 GIT binary patch delta 955 zcmV;s14R7W55)(N7=Hu<0000W_+m@|001yhOjJdG000>o88{LUBO@a$EG$GdC_Ozr zPChV6Nl95oH)2aWaaKfkTSt3&X@Ae9?6i?oICkEmixEnW zr4V{tW{i|m3C5FhE+z4P$z_X!>p2~}}A;J_jdRRQteeWdvrWib&XW0X~3A@B!*YEAzdpGJh**EWxxPA_?>zvp2p0LrG=j z<#=35piY#9;4VNVIwr=px=GMB)qN_O`N?;}F2U8$7#7N)w2}L{e9Jav|g#MR?DytsMU&Uxt3vYAS&U&oa$_FiDPVy ze@dx506_*BHdHPMhb&YHC(BrQEyJjq7mpT9Ia>rJ1bPRnxb~!gxuc~}3CA`Uh;*_k zqQ0#xdRqdMW9vVx(6Q&2~#5^fo7 zE|AtwHOf(?jFb_WxeST`mJ+I%rHs_OJzUK&C_f~ee%ldV&Pd}M*z8=tjv>SP+SQUx zRnN+-U@gP+H3ADc>1`?u!+*WbJ1-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VmPAuoYzX-lgt=T69k_~F^t7Lh9h`qOzYei3C=E6}&Z?{1MiL|Kgr4X^M@ z`Db!Qt^4)o-G@CJrsl7kM&`6V8qkkcp{6$OMcy^7A9}T|V;%9A{Whvyok8sy1OH~M ohmTro(S=}T Date: Tue, 6 Apr 2021 14:50:34 +0200 Subject: [PATCH 3/7] Add bossbars --- mods/CORE/mcl_util/init.lua | 2 +- mods/ENTITIES/mcl_mobs/api.lua | 16 +-- mods/ENTITIES/mobs_mc/ender_dragon.lua | 3 + mods/ENTITIES/mobs_mc/wither.lua | 3 +- mods/HUD/mcl_bossbars/init.lua | 124 ++++++++++++++++++ mods/HUD/mcl_bossbars/mod.conf | 4 + .../mcl_bossbars/textures/mcl_bossbars.png | Bin 0 -> 3689 bytes .../textures/mcl_bossbars_empty.png | Bin 0 -> 3369 bytes 8 files changed, 142 insertions(+), 10 deletions(-) create mode 100644 mods/HUD/mcl_bossbars/init.lua create mode 100644 mods/HUD/mcl_bossbars/mod.conf create mode 100644 mods/HUD/mcl_bossbars/textures/mcl_bossbars.png create mode 100644 mods/HUD/mcl_bossbars/textures/mcl_bossbars_empty.png diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index a43c3d5d0b..ac913de390 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -410,7 +410,7 @@ function mcl_util.get_color(colorstr) local mc_color = mcl_colors[colorstr:upper()] if mc_color then colorstr = mc_color - elseif #colorstr ~= 7 or colorstr:sub(1, 1) ~= "#"then + elseif #colorstr ~= 7 or colorstr:sub(1, 1) ~= "#" then return end local hex = tonumber(colorstr:sub(2, 7), 16) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6e932ed5e5..e599f21277 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3526,14 +3526,6 @@ local mob_step = function(self, dtime) -- end rotation - -- knockback timer - if self.pause_timer > 0 then - - self.pause_timer = self.pause_timer - dtime - - return - end - -- run custom function (defined in mob lua file) if self.do_custom then @@ -3543,6 +3535,14 @@ local mob_step = function(self, dtime) end end + -- knockback timer + if self.pause_timer > 0 then + + self.pause_timer = self.pause_timer - dtime + + return + end + -- attack timer self.timer = self.timer + dtime diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index ddaea360f8..509409a2e2 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -59,6 +59,9 @@ mobs:register_mob("mobs_mc:enderdragon", { run_start = 0, run_end = 20, }, ignores_nametag = true, + do_custom = function(self) + mcl_bossbars.update_boss(self, "Ender Dragon", "light_purple") + end, on_die = function(self, pos) if not self._respawned then mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index caf5a248d3..8e7f7eb95d 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -73,6 +73,7 @@ mobs:register_mob("mobs_mc:wither", { self.object:set_properties({textures={self.base_texture}}) self.armor = {undead = 80, fleshy = 80} end + mcl_bossbars.update_boss(self, "Wither", "dark_purple") end, on_spawn = function(self) minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64}) @@ -115,4 +116,4 @@ mobs:register_arrow("mobs_mc:wither_skull", { --Spawn egg mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true) -mcl_wip.register_wip_item("mobs_mc:wither") \ No newline at end of file +mcl_wip.register_wip_item("mobs_mc:wither") diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua new file mode 100644 index 0000000000..38dbbe3762 --- /dev/null +++ b/mods/HUD/mcl_bossbars/init.lua @@ -0,0 +1,124 @@ +mcl_bossbars = { + bars = {}, + huds = {}, + colors = {"light_purple", "blue", "red", "green", "yellow", "dark_purple", "white"}, +} + +function mcl_bossbars.recalculate_colors() + local sorted = {} + local colors = mcl_bossbars.colors + local color_count = #colors + local frame_count = color_count * 2 + for i, color in ipairs(colors) do + local idx = i * 2 - 1 + local image = "mcl_bossbars.png" + .. "^[transformR270" + .. "^[verticalframe:" .. frame_count .. ":" .. (idx - 1) + .. "^(mcl_bossbars_empty.png" + .. "^[lowpart:%d:mcl_bossbars.png" + .. "^[transformR270" + .. "^[verticalframe:" .. frame_count .. ":" .. idx .. ")" + local _, hex = mcl_util.get_color(color) + sorted[color] = { + image = image, + hex = hex, + } + end + mcl_bossbars.colors_sorted = sorted +end + +function mcl_bossbars.update_bar(player, text, color, percentage) + local cdef = mcl_bossbars.colors_sorted[color] + table.insert(mcl_bossbars.bars[player:get_player_name()], {color = cdef.hex, text = text, image = string.format(cdef.image, percentage)}) +end + +function mcl_bossbars.update_boss(luaentity, name, color) + local object = luaentity.object + local text = luaentity.nametag + if not text or text == "" then + text = name + end + local percentage = math.floor(luaentity.health / luaentity.hp_max * 100) + for _, obj in pairs(minetest.get_objects_inside_radius(object:get_pos(), 128)) do + if obj:is_player() then + mcl_bossbars.update_bar(obj, text, color, percentage) + end + end +end + +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + mcl_bossbars.huds[name] = {} + mcl_bossbars.bars[name] = {} +end) + +minetest.register_on_leaveplayer(function(player) + local name = player:get_player_name() + mcl_bossbars.huds[name] = nil + mcl_bossbars.bars[name] = nil +end) + +minetest.register_globalstep(function() + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + local bars = mcl_bossbars.bars[name] + local huds = mcl_bossbars.huds[name] + local huds_new = {} + local i = 0 + + while #huds > 0 or #bars > 0 do + local bar = table.remove(bars, 1) + local hud = table.remove(huds, 1) + + if bar and not hud then + hud = { + color = bar.color, + image = bar.image, + text = bar.text, + text_id = player:hud_add({ + hud_elem_type = "text", + text = bar.text, + number = bar.color, + position = {x = 0.5, y = 0}, + alignment = {x = 0, y = 1}, + offset = {x = 0, y = i * 40}, + }), + image_id = player:hud_add({ + hud_elem_type = "image", + text = bar.image, + position = {x = 0.5, y = 0}, + alignment = {x = 0, y = 1}, + offset = {x = 0, y = i * 40 + 25}, + scale = {x = 3, y = 3}, + }), + } + elseif hud and not bar then + player:hud_remove(hud.text_id) + player:hud_remove(hud.image_id) + hud = nil + else + if bar.text ~= hud.text then + player:hud_change(hud.text_id, "text", bar.text) + hud.text = bar.text + end + + if bar.color ~= hud.color then + player:hud_change(hud.text_id, "number", bar.color) + hud.color = bar.color + end + + if bar.image ~= hud.image then + player:hud_change(hud.image_id, "text", bar.image) + hud.image = bar.image + end + end + + table.insert(huds_new, hud) + i = i + 1 + end + + mcl_bossbars.huds[name] = huds_new + end +end) + +mcl_bossbars.recalculate_colors() diff --git a/mods/HUD/mcl_bossbars/mod.conf b/mods/HUD/mcl_bossbars/mod.conf new file mode 100644 index 0000000000..64cbd4c9f7 --- /dev/null +++ b/mods/HUD/mcl_bossbars/mod.conf @@ -0,0 +1,4 @@ +name = mcl_bossbars +author = Fleckenstein +description = Show enderdragon & wither boss bars. Also allows custom bars. +depends = mcl_util, mcl_colors diff --git a/mods/HUD/mcl_bossbars/textures/mcl_bossbars.png b/mods/HUD/mcl_bossbars/textures/mcl_bossbars.png new file mode 100644 index 0000000000000000000000000000000000000000..55bf36dc288f271d12228a67a6a39c98c6ca18e9 GIT binary patch literal 3689 zcmai1cT^L~(hnlii#!lDfPhF-E?s(&5`qv2Ni-w~NC^-rL3-~BB1NKfNB}`XuK{TR z6hx^4f{m&IN{e(sFfaGr``zpHy>q@jXLn|2W`8sDJNw7(9jLi6C);T@006*g0yc!v zC5S#7Ss3Xn+=0Cs0AN=NMp*g6>;pu+ym8K0cZ`T{kQYV-6Nq&N00Q4t=Ggm-OIO{Z zx$)P>0;2T#85kDZga$Si6TnF173A?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mNg*Wtn6M(_N)YuRZ&m;t*?>4p%+JTq8pigO&~_h^GA~ad*(~W}oravG zok$xJ6_ZzcQ7Pb?m(6L0=NMJSS~PqY$8(KcnjpCDn%tkxoXM%%F>JNS7Vl}xge+Se zhW7+(o!Pan=->9%5prDP{%(_a!`fq_w(m;wweCL2y};P6>+&Z#j>Y`HVxc38pd)th fnwk(!NepGcs%U*f-ravruNYurWNuice?9u&V{+xc literal 0 HcmV?d00001 diff --git a/mods/HUD/mcl_bossbars/textures/mcl_bossbars_empty.png b/mods/HUD/mcl_bossbars/textures/mcl_bossbars_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..1e50b6afc2a8dddc0748ae7763a5975ef6956b24 GIT binary patch literal 3369 zcmbVPS5Om-(hVh)P=!eEO{qeVUZoSHg-+-gYUm|EKuDC1fRsp+Dr%^Lpr4@h-jR+- zmk!bdGzgb(=70Sk?maVS&zv*6v#+~}CPun6AT|&H0HD#=(}LZo&J90Mkla)=7phtS z02CTwZXFDBM)CLu`nh=`5j?@+{s65H`OLH%%1~rM=t)qe&%abJhT4o__Co zmn3t)n|-g{{KDZGZCL>gv0&22CQ^|53X4`2*~$e0{s7wf4(v zQ>8m_akR28N<7MkZf%XYM0icw(b2n=fND6YWmnzMTk}Sb5kT82V^J%vZF|y;Mtd@P z4HHv^11cu)nZ*0mwI#Gos+-@Bo(5hIhs33B7Y?x0Lts;-g1EvmjiU9Oh0>+mz0$Q=~=Dy}?|T0qTF?^61L zeDy`*NfguA<&Ta7{53-1d};ADy4E}73k7{P+*B&EIEZXc77(ubkuo(&ttVVXx3i?K zmvTUSMBaaBk^z&=3Dd_#%zM5Z%@xuRYk0ew>4ClLH(`e#9~v<`;`gcegct;k2vr0A zKwpnqf6e{)^0ymo2uW!#?ELO2{4x4zYxBh&-C4Avmhet&W~G==U@-TQAZG%P%@6sG<= zSvqF2ITV{4E9$-6V_y$;zJ*^En(?kF56rf$oVILs6CV(})NKLp;_^$>>-^wmiy=``mH;W^OMPzwP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SwWZp literal 0 HcmV?d00001 From 962a13847e64613e53f1a2542860d3439a9a6d4f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 6 Apr 2021 14:57:29 +0200 Subject: [PATCH 4/7] Fix dragons summoned using commands spawning an egg on the exit portal --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 4 ++-- mods/ITEMS/mcl_end/end_crystal.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 509409a2e2..01c3465796 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -63,9 +63,9 @@ mobs:register_mob("mobs_mc:enderdragon", { mcl_bossbars.update_boss(self, "Ender Dragon", "light_purple") end, on_die = function(self, pos) - if not self._respawned then + if self._portal_pos then mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 - minetest.set_node(self._portal_pos and minetest.string_to_pos(self._portal_pos) or vector.add(mcl_vars.mg_end_platform_pos, vector.new(-27, 2, 0)), {name = mobs_mc.items.dragon_egg}) + minetest.set_node(minetest.string_to_pos(self._portal_pos), {name = mobs_mc.items.dragon_egg}) end end, fire_resistant = true, diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index 8fcf67a1d6..9e4fa13fd6 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -58,7 +58,7 @@ local function spawn_crystal(pos) for _, crystal in pairs(crystals) do crystal_explode(crystal) end - minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon"):get_luaentity()._respawned = true + minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon") end minetest.register_entity("mcl_end:crystal", { From 83b9cf3ad258620ff3b89bc9c1ce01b02220b82e Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 6 Apr 2021 15:48:17 +0200 Subject: [PATCH 5/7] End exit portal openng / closing on dragon death / spawn --- mods/ENTITIES/mobs_mc/ender_dragon.lua | 8 ++++++-- mods/ITEMS/mcl_end/end_crystal.lua | 4 +++- mods/MAPGEN/mcl_mapgen_core/init.lua | 14 ++++++++++---- mods/MAPGEN/mcl_structures/init.lua | 12 ++++++++++-- .../mcl_structures_end_exit_portal.mts | Bin 222 -> 193 bytes .../mcl_structures_end_exit_portal_open.mts | Bin 0 -> 222 bytes 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_exit_portal_open.mts diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 01c3465796..50aaacd4bf 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -64,8 +64,12 @@ mobs:register_mob("mobs_mc:enderdragon", { end, on_die = function(self, pos) if self._portal_pos then - mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 - minetest.set_node(minetest.string_to_pos(self._portal_pos), {name = mobs_mc.items.dragon_egg}) + local portal_pos = minetest.string_to_pos(self._portal_pos) + mcl_structures.call_struct(portal_pos, "end_exit_portal_open") + if self._initial then + mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 + minetest.set_node(vector.add(portal_pos, vector.new(3, 5, 3)), {name = mobs_mc.items.dragon_egg}) + end end end, fire_resistant = true, diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index 9e4fa13fd6..63a37d3c6d 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -58,7 +58,9 @@ local function spawn_crystal(pos) for _, crystal in pairs(crystals) do crystal_explode(crystal) end - minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon") + local portal_pos = vector.add(portal_center, vector.new(-3, -1, -3)) + mcl_structures.call_struct(portal_pos, "end_exit_portal") + minetest.add_entity(vector.add(portal_pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = minetest.pos_to_string(portal_pos) end minetest.register_entity("mcl_end:crystal", { diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index e08b55ba30..237579dbe4 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -54,8 +54,7 @@ local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superfl local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor --- End exit portal position. This is temporary. --- TODO: Remove the exit portal generation when the ender dragon has been implemented. +-- End exit portal position local END_EXIT_PORTAL_POS = table.copy(mcl_vars.mg_end_platform_pos) END_EXIT_PORTAL_POS.x = END_EXIT_PORTAL_POS.x - 30 END_EXIT_PORTAL_POS.z = END_EXIT_PORTAL_POS.z - 3 @@ -1251,6 +1250,13 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_ return lvm_used end +local function generate_end_exit_portal(pos) + local dragon_entity = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity() + dragon_entity._initial = true + dragon_entity._portal_pos = minetest.pos_to_string(pos) + mcl_structures.call_struct(pos, "end_exit_portal") +end + -- TODO: Try to use more efficient structure generating code local function generate_structures(minp, maxp, blockseed, biomemap) local chunk_has_desert_well = false @@ -1490,11 +1496,11 @@ local function generate_structures(minp, maxp, blockseed, biomemap) for y=maxp.y, minp.y, -1 do local p = {x=END_EXIT_PORTAL_POS.x, y=y, z=END_EXIT_PORTAL_POS.z} if minetest.get_node(p).name == "mcl_end:end_stone" then - mcl_structures.call_struct(p, "end_exit_portal") + generate_end_exit_portal(p) return end end - mcl_structures.call_struct(END_EXIT_PORTAL_POS, "end_exit_portal") + generate_end_exit_portal(END_EXIT_PORTAL_POS) end end diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 4294215a91..d75854352d 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -87,6 +87,8 @@ mcl_structures.call_struct = function(pos, struct_style, rotation, pr) return mcl_structures.generate_fossil(pos, rotation, pr) elseif struct_style == "end_exit_portal" 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_portal_shrine" then return mcl_structures.generate_end_portal_shrine(pos, rotation, pr) end @@ -313,11 +315,15 @@ mcl_structures.generate_fossil = function(pos, rotation, pr) end mcl_structures.generate_end_exit_portal = function(pos, rot) - minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity()._portal_pos = minetest.pos_to_string(vector.add(pos, vector.new(3, 5, 3))) local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts" return mcl_structures.place_schematic(pos, path, rot or "0", nil, true) end +mcl_structures.generate_end_exit_portal_open = function(pos, rot) + local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal_open.mts" + return mcl_structures.place_schematic(pos, path, rot or "0", nil, true) +end + local function shrine_placement_callback(p1, p2, size, rotation, pr) -- Find and setup spawner with silverfish local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner") @@ -535,7 +541,7 @@ end -- Debug command minetest.register_chatcommand("spawnstruct", { - params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | nether_portal | dungeon", + params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_opens | end_portal_shrine | nether_portal | dungeon", description = S("Generate a pre-defined structure near your position."), privs = {debug = true}, func = function(name, param) @@ -567,6 +573,8 @@ minetest.register_chatcommand("spawnstruct", { mcl_structures.generate_ice_spike_large(pos, rot, pr) elseif param == "end_exit_portal" 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_portal_shrine" then mcl_structures.generate_end_portal_shrine(pos, rot, pr) elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_exit_portal.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_exit_portal.mts index bc24f800a6de0e4265fdbe08808c9720061b8490..30d145bd7fdc822259191c918696b74769628d72 100644 GIT binary patch delta 154 zcmcb|c#u)pHze4XfrWvcft7*19t0RzCJGzWmE;#CXQUQef$8}2#GIUpIa?=n^ED`N zxH`Vx{qw7j;reJ1ys)}uDrD>;&p_i$xl%M#|4o_Hb;dWRuj`fdDjvh*7QKNMy&unx^$sU)L+^RXm2rEqVhjdOw~yd0eDy%Dic&uPyg1I8yyH zO~3W?FE<7=#tl0-et5I*%~5yCuvOaK+coXSeq%5FGkVh6GdgztnH3o08erZh5UT|M Dl|EWe literal 0 HcmV?d00001 From 1d587b88955fc1de22e78e8dc64c9d440725ed8d Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 6 Apr 2021 15:59:59 +0200 Subject: [PATCH 6/7] Fix crash in wieldview --- mods/PLAYER/wieldview/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/PLAYER/wieldview/init.lua b/mods/PLAYER/wieldview/init.lua index 48f3f99bd9..6021dd3696 100644 --- a/mods/PLAYER/wieldview/init.lua +++ b/mods/PLAYER/wieldview/init.lua @@ -70,6 +70,10 @@ minetest.register_on_joinplayer(function(player) local name = player:get_player_name() wieldview.wielded_item[name] = "" minetest.after(0, function(player) + -- if the player left :is_player() will return nil + if not player:is_player() then + return + end wieldview:update_wielded_item(player) local itementity = minetest.add_entity(player:get_pos(), "wieldview:wieldnode") itementity:set_attach(player, "Hand_Right", vector.new(0, 1, 0), vector.new(90, 0, 45)) From 38a12e59daebe9efc9f797db4c12e8ab2263d5b1 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 6 Apr 2021 16:02:18 +0200 Subject: [PATCH 7/7] Fix comment indentation in wieldview --- mods/PLAYER/wieldview/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/wieldview/init.lua b/mods/PLAYER/wieldview/init.lua index 6021dd3696..7a349f2f37 100644 --- a/mods/PLAYER/wieldview/init.lua +++ b/mods/PLAYER/wieldview/init.lua @@ -115,10 +115,11 @@ minetest.register_entity("wieldview:wieldnode", { local def = minetest.registered_items[itemstring] self.object:set_properties({glow = def and def.light_source or 0}) - -- wield item as cubic + -- wield item as cubic if armor.textures[self.wielder].wielditem == "blank.png" then self.object:set_properties({textures = {itemstring}}) - else -- wield item as flat + -- wield item as flat + else self.object:set_properties({textures = {""}}) end