From eee07f56b5d99aaffbd6ed6534e2301800a9b2e8 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Thu, 17 Feb 2022 17:39:45 -0300 Subject: [PATCH 01/11] Make sideways hoppers try pushing down before sideways This is consistent with its behaviour in Minecraft. --- mods/ITEMS/mcl_hoppers/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 36a21ad95..7d0c9d531 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -453,6 +453,11 @@ minetest.register_abm({ end end + -- Try to move an item below before moving it sideways + local downnode = minetest.get_node(downpos) + if not minetest.registered_nodes[downnode.name] then return end + if mcl_util.move_item_container(pos, downpos) then return end + -- Move an item from the hopper into the container to which the hopper points to local g = minetest.registered_nodes[frontnode.name].groups.container if g == 2 or g == 3 or g == 5 or g == 6 then From 0c6da14e1fd8651ec010606a617d10bf95a6f845 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Thu, 17 Feb 2022 21:30:15 -0300 Subject: [PATCH 02/11] Set _removed to true in item entities sucked by hoppers This double-check might just prevent future commits from triggering regressions allowing hoppers to duplicate items. --- mods/ITEMS/mcl_hoppers/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 7d0c9d531..aceab7160 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -350,7 +350,8 @@ minetest.register_abm({ local inv = meta:get_inventory() for _,object in pairs(minetest.get_objects_inside_radius(pos, 2)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and not object:get_luaentity()._removed then + local entity = object:get_luaentity() + if not object:is_player() and entity and entity.name == "__builtin:item" and not entity._removed then if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then -- Item must get sucked in when the item just TOUCHES the block above the hopper -- This is the reason for the Y calculation. @@ -359,7 +360,8 @@ minetest.register_abm({ local posob_miny = posob.y + object:get_properties().collisionbox[2] if math.abs(posob.x-pos.x) <= 0.5 and (posob_miny-pos.y < 1.5 and posob.y-pos.y >= 0.3) then inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) - object:get_luaentity().itemstring = "" + entity._removed = true + entity.itemstring = "" object:remove() end end From 2c8194bd6df6a9320b994a141149bf1d4625f848 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Thu, 17 Feb 2022 21:34:01 -0300 Subject: [PATCH 03/11] Slight reorder to prevent race condition in hopper item collection --- mods/ITEMS/mcl_hoppers/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index aceab7160..d488527c3 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -359,10 +359,10 @@ minetest.register_abm({ local posob = object:get_pos() local posob_miny = posob.y + object:get_properties().collisionbox[2] if math.abs(posob.x-pos.x) <= 0.5 and (posob_miny-pos.y < 1.5 and posob.y-pos.y >= 0.3) then - inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) entity._removed = true entity.itemstring = "" object:remove() + inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) end end end From 024904eadd884feedd1a840f7ab577a690cde919 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Sat, 19 Feb 2022 12:36:06 -0300 Subject: [PATCH 04/11] Use get_item_group accessor in hopper code --- mods/ITEMS/mcl_hoppers/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index d488527c3..e12649cae 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -343,7 +343,7 @@ minetest.register_abm({ local abovenode = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) if not minetest.registered_items[abovenode.name] then return end -- Don't bother checking item enties if node above is a container (should save some CPU) - if minetest.registered_items[abovenode.name].groups.container then + if get_item_group(abovenode.name, "container") then return end local meta = minetest.get_meta(pos) @@ -399,7 +399,7 @@ minetest.register_abm({ -- Suck an item from the container above into the hopper local upnode = minetest.get_node(uppos) if not minetest.registered_nodes[upnode.name] then return end - local g = minetest.registered_nodes[upnode.name].groups.container + local g = get_item_group(upnode.name, "container") local sucked = mcl_util.move_item_container(uppos, pos) -- Also suck in non-fuel items from furnace fuel slot @@ -444,7 +444,7 @@ minetest.register_abm({ -- Suck an item from the container above into the hopper local abovenode = minetest.get_node(above) if not minetest.registered_nodes[abovenode.name] then return end - local g = minetest.registered_nodes[abovenode.name].groups.container + local g = get_item_group(abovenode.name, "container") local sucked = mcl_util.move_item_container(above, pos) -- Also suck in non-fuel items from furnace fuel slot @@ -461,7 +461,7 @@ minetest.register_abm({ if mcl_util.move_item_container(pos, downpos) then return end -- Move an item from the hopper into the container to which the hopper points to - local g = minetest.registered_nodes[frontnode.name].groups.container + local g = get_item_group(frontnode.name, "container") if g == 2 or g == 3 or g == 5 or g == 6 then mcl_util.move_item_container(pos, front) elseif g == 4 then From 4af046500d48ba9e7ba9153eb3052b4a7165b108 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 2 May 2022 10:42:29 +0200 Subject: [PATCH 05/11] Remove preview files --- .../textures/mcl_armor_boots_chain_preview.png | Bin 156 -> 0 bytes .../textures/mcl_armor_boots_diamond_preview.png | Bin 157 -> 0 bytes .../textures/mcl_armor_boots_gold_preview.png | Bin 150 -> 0 bytes .../textures/mcl_armor_boots_iron_preview.png | Bin 140 -> 0 bytes .../textures/mcl_armor_boots_leather_preview.png | Bin 131 -> 0 bytes .../mcl_armor_chestplate_chain_preview.png | Bin 255 -> 0 bytes .../mcl_armor_chestplate_diamond_preview.png | Bin 210 -> 0 bytes .../mcl_armor_chestplate_gold_preview.png | Bin 202 -> 0 bytes .../mcl_armor_chestplate_iron_preview.png | Bin 215 -> 0 bytes .../mcl_armor_chestplate_leather_preview.png | Bin 150 -> 0 bytes .../textures/mcl_armor_helmet_chain_preview.png | Bin 149 -> 0 bytes .../textures/mcl_armor_helmet_diamond_preview.png | Bin 208 -> 0 bytes .../textures/mcl_armor_helmet_gold_preview.png | Bin 190 -> 0 bytes .../textures/mcl_armor_helmet_iron_preview.png | Bin 162 -> 0 bytes .../textures/mcl_armor_helmet_leather_preview.png | Bin 147 -> 0 bytes .../textures/mcl_armor_leggings_chain_preview.png | Bin 133 -> 0 bytes .../mcl_armor_leggings_diamond_preview.png | Bin 197 -> 0 bytes .../textures/mcl_armor_leggings_gold_preview.png | Bin 171 -> 0 bytes .../textures/mcl_armor_leggings_iron_preview.png | Bin 168 -> 0 bytes .../mcl_armor_leggings_leather_preview.png | Bin 165 -> 0 bytes 20 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_boots_chain_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_boots_diamond_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_boots_gold_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_boots_iron_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_boots_leather_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_chain_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_diamond_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_gold_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_iron_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_leather_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_chain_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_diamond_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_gold_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_iron_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_leather_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_chain_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_diamond_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_gold_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_iron_preview.png delete mode 100644 mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_leather_preview.png diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_chain_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_chain_preview.png deleted file mode 100644 index bf028c2724094d9a9bbce2c2fdba51ac58ba1aa3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNT~$)gt!7}RW%(aS5F;1V+$+$ zmb&uEeI4u9EDeu}wY9Yk3G~lSj{9>hE)1xSu_VYZn8D%MjWi%f&C|s(q=GS7Vxq$d zmlG^!IJCX>nT=I^R1}o@92nBhMD45+XJ%$7VqmMgTe~DWM4f8GI^p diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_diamond_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_diamond_preview.png deleted file mode 100644 index 768d7bcdec0545c89d30f4d7421c7b32fd6be2c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNXZ5Ggt!7}TU%RCPfr~ko#5#Q z&e?};C0vgKo5t-V%0^WXFT+qR~ZJ)(>QqmXnP!|)(NNczkwPVJYD@<);T3K0RUFT BFckm* diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_gold_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_gold_preview.png deleted file mode 100644 index f384a602c498dd728595a537e78282be558b5fc5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt!9fB^63nmYcphn6#@$ zYg&p*-n}i~fuf8hL4Lsu4$p3+0XasVE{-7;jL8y=4S@}T3}*sFL`2w(eOOrM9^?@f tbXPYxe9_aDbP0l+XkK(4r=$ diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_leather_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_boots_leather_preview.png deleted file mode 100644 index d0457ce9a7d955896fd0f8d0139c8f0a5b39e674..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt#W>=k&JZm1Kk^1i7@; zX3d&XuTXwG5h%-8666=m;PC858jvIJ>Eakt!I&&@(;>h!fb)z28||b{UMcMcRLbD#>gTe~DWM4fx;`Vu diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_chain_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_chain_preview.png deleted file mode 100644 index af9c982fe54dd7307e125c4adfbfac6db0443727..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3-pI!a4o{DVqSF5LX~Qxv%5o@q?;rI+2p{ zPOhFhdd3!3_Uji+Sifdzc5+;Vj= z^)r?P`2{mLJiCzw

_kIEGX(-aT`bky(MqH84i$#lPL(0`D&<+JAyEX`kBbnh%CY zr+Al%1!VIbOrP)lajTrdc^M~7rI~yIr_QWe+xf$TVNV*X!w3Eedj);=YR~_?l_~I9 zf}E(x1>s|Jvd>%IOL${?Z$Ssg{`U>bc@22WQ%mvv4FO#tnw BVJZLs diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_diamond_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_diamond_preview.png deleted file mode 100644 index d43b3cedec607d213131735e032d8f939a1f2eef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNXZ5Ggt!7}TU%RCPtO&P{=fbH zUq?r${M_&ObvJ^iA9SsqcOvAgHc$m)NswPKgTu2MX+Tbrr;B4q1!M98xrC4)AqL}? zSRbCoDH_hZ3X3eA6`Wh0(hG0$EGui{W4zdR&fyqe+f2q&=k(mx7)!b^t6aJy70KLq zO8N5TbuejKib}Sht-qOeTinbR?vqkLMT{jue!&b5&u*jvIpLlzjv*C{$qVEJSQG^W zgvvr#F0RSya`a?$U|SrJG-DA%hoV%R6i3nqtyQd?tPK*4iy9XxuvM>|6;Q!A;h>?d w$(BuwOXkl!dXO`JMRcqSU@h_q|yB_#x;FVJRSNO&l;szcFl0?;M~Pgg&e IbxsLQ0O!F)0RR91 diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_leather_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_chestplate_leather_preview.png deleted file mode 100644 index 9d5a5a097e73aeeefc06feeb97a2694c873fcc3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt!9fw%V*&Q|e1H!j>)R z-?n|p@@m6gpeSQWkY6x^!?PP{K#q~8i(^OyWAXwy0U@&x7Gsw=Au@_R0^#l diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_chain_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_chain_preview.png deleted file mode 100644 index c76cd9d61b8ac128b633c531a2331afb4210f87f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNQnmcgt!9f?BuwXy7KjFmYzI* zaB^SA(N-&lL`2{mLJiCzwH1W!N6lgserXL2J@k3dO~UogXeIACOA z`p;zRaa0{BXYc9a7*fHQoRA=3#2J>t(D>w2k+FgD9;H1(X9^M`4=|?rBqTH#$Vf<7 u9PBy4)~D&v^?OYW!|TKL(h_Z&3=9oST)#Ima|Zy8V(@hJb6Mw<&;$V7qDCtK diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_gold_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_gold_preview.png deleted file mode 100644 index 4201916caa17a5d9d514feb328865cec352aff37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNT~$)gt!9fT|HXUQdE{yD7D4S z^tH*jvfT95!6cqM2EIB5o&pA*T!y*H3+sXEcuIo&f*Jlp03#C<(}wy32|#gMPZ!6K z3dZDw1OX$?uoMQy)Qb+v28Rvy`Usp6NDxn8Ha>EL=afPa=bO$1w#^K)874fMag-rs f)8@v+8B7cbMr_l|*Gc674Px+g^>bP0l+XkKt&==k diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_iron_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_iron_preview.png deleted file mode 100644 index 00584e8de1f73ca3749fd2553d24d7adbef73e81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNJ#|vgt!9f?Buw~eI4u9EIoPr zU`t(jNTC1ICl9K`FN*=?7)yfuf*Bm1-ADs+EIeHtLn;`P6A}cB47pf>9NIQ+)S98V zVvQP08pj5117`^xMxBH@{8E&Bif diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_leather_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_helmet_leather_preview.png deleted file mode 100644 index 9f27bacb5416e3004514f22e4a820b7b9e82b0c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt!9fgdmrajIg%atXWg) zmo4dEQ@&ptD9Tt8KgoNzh8a;AW}pCk>8DmX3X=fr=SCUHx3vIVCg!0PY_m8~^|S diff --git a/mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_diamond_preview.png b/mods/ITEMS/mcl_armor/textures/mcl_armor_leggings_diamond_preview.png deleted file mode 100644 index cbc9e032c4c76ec69e16c6f131284552e3ca4033..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3HFyJAa%3Qazq7jv*C{$qTF|OiW6gGC47k z>5`8Zmq3(PQ>$l0N2jODjF}S?k2C}taJe=1^_{Daj*d29+j#LO3opmKx)1e#c1b7j zBrX2PDa{ZZQ}^zBy-v;{wgV<>D!#}s<2=IFDVWZ%i_L_YQ~E)aHUAREmc&Gc=gm(t s3f9N5gDC+cTS| zJvzT?UT5X59<3|OOoaj3q&S!3+-1ZlnP@cAhSdAr*|t5=R_7E(S=PDJTsrWHP=J z6ytn==ex*vffZ7Ut_I3FuBIGkIQ#?sn>6?ey&JRIjd)rc*(R|uBztn6`la(>8qg#L MPgg&ebxsLQ02o3v!T5`8Zmq3(PQ>$l0N2jODjF}TNn%xd+NU$zmprZW7-p*$VWA4_-1fHbDA33ENf-JJV zY$cj+WYkzmFa+($@w5kW0_mdKI;Vst0FLlCT>t<8 From a4655a0c2349b17595ab0a89d8eb4c875cf19752 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 2 May 2022 10:39:49 +0200 Subject: [PATCH 06/11] Fix player armor enchanting overlay (#2161) --- mods/ITEMS/mcl_enchanting/engine.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index d6407d0bc..703087fc7 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -271,8 +271,10 @@ function mcl_enchanting.initialize() new_def.groups.not_in_craft_guide = 1 new_def.groups.enchanted = 1 - if new_def._mcl_armor_texture and not type(new_def._mcl_armor_texture) == "function" then - new_def._mcl_armor_texture = new_def._mcl_armor_texture .. mcl_enchanting.overlay + if new_def._mcl_armor_texture then + if type(new_def._mcl_armor_texture) == "string" then + new_def._mcl_armor_texture = new_def._mcl_armor_texture .. mcl_enchanting.overlay + end end if new_def._mcl_armor_preview and not type(new_def._mcl_armor_preview) == "function" then new_def._mcl_armor_preview = new_def._mcl_armor_preview .. mcl_enchanting.overlay From 48c8eaa6edb32bc9cbd832011d3af0fc0d0fcf88 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 2 May 2022 10:18:25 +0200 Subject: [PATCH 07/11] Remove 2D preview by AFCMS --- mods/HUD/mcl_inventory/creative.lua | 11 +- mods/HUD/mcl_inventory/init.lua | 10 +- mods/ITEMS/mcl_armor/API.md | 288 ++++++++++++++++++ mods/ITEMS/mcl_armor/api.lua | 17 +- mods/ITEMS/mcl_armor/player.lua | 2 +- mods/ITEMS/mcl_enchanting/engine.lua | 3 - mods/ITEMS/mcl_farming/pumpkin.lua | 1 - .../mcl_farming_pumpkin_face_preview.png | Bin 240 -> 0 bytes mods/ITEMS/mcl_heads/init.lua | 1 - .../textures/mcl_heads_creeper_preview.png | Bin 165 -> 0 bytes .../textures/mcl_heads_skeleton_preview.png | Bin 156 -> 0 bytes .../textures/mcl_heads_steve_preview.png | Bin 166 -> 0 bytes .../mcl_heads_wither_skeleton_preview.png | Bin 156 -> 0 bytes .../textures/mcl_heads_zombie_preview.png | Bin 161 -> 0 bytes mods/PLAYER/mcl_player/init.lua | 23 +- mods/PLAYER/mcl_skins/.gitignore | 4 + mods/PLAYER/mcl_skins/init.lua | 34 +-- .../mcl_skins/textures/mcl_skins_player_1.png | Bin 2625 -> 0 bytes .../textures/mcl_skins_player_dummy.png | Bin 982 -> 0 bytes settingtypes.txt | 3 - 20 files changed, 310 insertions(+), 87 deletions(-) create mode 100644 mods/ITEMS/mcl_armor/API.md delete mode 100644 mods/ITEMS/mcl_farming/textures/mcl_farming_pumpkin_face_preview.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_creeper_preview.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_preview.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_steve_preview.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_wither_skeleton_preview.png delete mode 100644 mods/ITEMS/mcl_heads/textures/mcl_heads_zombie_preview.png create mode 100644 mods/PLAYER/mcl_skins/.gitignore delete mode 100644 mods/PLAYER/mcl_skins/textures/mcl_skins_player_1.png delete mode 100644 mods/PLAYER/mcl_skins/textures/mcl_skins_player_dummy.png diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index f2bd8076a..1bdd45a35 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -339,14 +339,6 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, if name == "inv" then inv_bg = "crafting_inventory_creative_survival.png" - -- Show armor and player image - local player_preview - if minetest.settings:get_bool("3d_player_preview", true) then - player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "") - else - player_preview = "image[3.9,1.4;1.2333,2.4666;"..mcl_player.player_get_preview(player).."]" - end - -- Background images for armor slots (hide if occupied) local armor_slot_imgs = "" local inv = player:get_inventory() @@ -386,8 +378,7 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, armor_slot_imgs.. -- player preview - player_preview.. - + mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "").. -- crafting guide button "image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]".. "tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]".. diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index 0a8b9a7bc..1b841ba80 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -61,14 +61,6 @@ local function set_inventory(player, armor_change_only) inv:set_width("craft", 2) inv:set_size("craft", 4) - -- Show armor and player image - local player_preview - if minetest.settings:get_bool("3d_player_preview", true) then - player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "") - else - player_preview = "image[1.1,0.2;2,4;"..mcl_player.player_get_preview(player).."]" - end - local armor_slots = {"helmet", "chestplate", "leggings", "boots"} local armor_slot_imgs = "" for a=1,4 do @@ -83,7 +75,7 @@ local function set_inventory(player, armor_change_only) local form = "size[9,8.75]".. "background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]".. - player_preview.. + mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "").. --armor "list[current_player;armor;0,0;1,1;1]".. "list[current_player;armor;0,1;1,1;2]".. diff --git a/mods/ITEMS/mcl_armor/API.md b/mods/ITEMS/mcl_armor/API.md new file mode 100644 index 000000000..06292aab4 --- /dev/null +++ b/mods/ITEMS/mcl_armor/API.md @@ -0,0 +1,288 @@ +# mcl_armor + +This mod implements the ability of registering armors. + +## Registering an Armor Set + +The `mcl_armor.register_set()` function aims to simplify the process of registering a full set of armor. + +This function register four pieces of armor (head, torso, leggings, feets) based on a definition table: + +```lua +mcl_armor.register_set({ + --name of the armor material (used for generating itemstrings) + name = "dummy_armor", + + --description of the armor material + --do NOT translate this string, it will be concatenated will each piece of armor's description and result will be automatically fetched from your mod's translation files + description = "Dummy Armor", + + --overide description of each armor piece + --do NOT localize this string + descriptions = { + head = "Cap", --default: "Helmet" + torso = "Tunic", --default: "Chestplate" + legs = "Pants", --default: "Leggings" + feet = "Shoes", --default: "Boots" + }, + + --this is used to calculate each armor piece durability with the minecraft algorithm + --head durability = durability * 0.6857 + 1 + --torso durability = durability * 1.0 + 1 + --legs durability = durability * 0.9375 + 1 + --feet durability = durability * 0.8125 + 1 + durability = 80, + + --this is used then you need to specify the durability of each piece of armor + --this field have the priority over the durability one + --if the durability of some pieces of armor isn't specified in this field, the durability field will be used insteed + durabilities = { + head = 200, + torso = 500, + legs = 400, + feet = 300, + }, + + --this define how good enchants you will get then enchanting one piece of the armor in an enchanting table + --if set to zero or nil, the armor will not be enchantable + enchantability = 15, + + --this define how much each piece of armor protect the player + --these points will be shown in the HUD (chestplate bar above the health bar) + points = { + head = 1, + torso = 3, + legs = 2, + feet = 1, + }, + + --this attribute reduce strong damage even more + --See https://minecraft.fandom.com/wiki/Armor#Armor_toughness for more explanations + --default: 0 + toughness = 2, + + --this field is used to specify some items groups that will be added to each piece of armor + --please note that some groups do NOT need to be added by hand, because they are already handeled by the register function: + --(armor, combat_armor, armor_, combat_armor_, mcl_armor_points, mcl_armor_toughness, mcl_armor_uses, enchantability) + groups = {op_armor = 1}, + + --specify textures that will be overlayed on the entity wearing the armor + --these fields have default values and its recommanded to keep the code clean by just using the default name for your textures + textures = { + head = "dummy_texture.png", --default: "_helmet_.png" + torso = "dummy_texture.png", --default: "_chestplate_.png" + legs = "dummy_texture.png", --default: "_leggings_.png" + feet = "dummy_texture.png", --default: "_boots_.png" + }, + --you can also define these fields as functions, that will be called each time the API function mcl_armor.update(obj) is called (every time you equip/unequip some armor piece, take damage, and more) + --note that the enchanting overlay will not appear unless you implement it in the function + --this allow to make armors where the textures change whitout needing to register many other armors with different textures + textures = { + head = function(obj, itemstack) + if mcl_enchanting.is_enchanted(itemstack) then + return "dummy_texture.png^"..mcl_enchanting.overlay + else + return "dummy_texture.png" + end + end, + }, + + --inventory textures aren't definable using a table similar to textures or previews + --you are forced to use the default texture names which are: + --head: "_inv_helmet_.png + --torso: "_inv_chestplate_.png + --legs: "_inv_leggings_.png + --feet: "_inv_boots_.png + + --this callback table allow you to define functions that will be called each time an entity equip an armor piece or the mcl_armor.on_equip() function is called + --the functions accept two arguments: obj and itemstack + on_equip_callbacks = { + head = function(obj, itemstack) + --do stuff + end, + }, + + --this callback table allow you to define functions that will be called each time an entity unequip an armor piece or the mcl_armor.on_unequip() function is called + --the functions accept two arguments: obj and itemstack + on_unequip_callbacks = { + head = function(obj, itemstack) + --do stuff + end, + }, + + --this callback table allow you to define functions that will be called then an armor piece break + --the functions accept one arguments: obj + --the itemstack isn't sended due to how minetest handle items which have a zero durability + on_break_callbacks = { + head = function(obj) + --do stuff + end, + }, + + --this is used to generate automaticaly armor crafts based on each element type folowing the regular minecraft pattern + --if set to nil no craft will be added + craft_material = "mcl_mobitems:leather", + + --this is used to generate cooking crafts for each piece of armor + --if set to nil no craft will be added + cook_material = "mcl_core:gold_nugget", --cooking any piece of this armor will output a gold nugged + + --this is used for allowing each piece of the armor to be repaired by using an anvil with repair_material as aditionnal material + --it basicaly set the _repair_material item field of each piece of the armor + --if set to nil no repair material will be added + repair_material = "mcl_core:iron_ingot", +}) +``` + +## Creating an Armor Piece + +If you don't want to register a full set of armor, then you will need to manually register your own single item. + +```lua +minetest.register_tool("dummy_mod:random_armor", { + description = S("Random Armor"), + + --these two item fields are used for ingame documentation + --the mcl_armor.longdesc and mcl_armor.usage vars contains the basic usage and purpose of a piece of armor + --these vars may not be enough for that you want to do, so you may add some extra informations like that: + --_doc_items_longdesc = mcl_armor.longdesc.." "..S("Some extra informations.") + _doc_items_longdesc = mcl_armor.longdesc, + _doc_items_usagehelp = mcl_armor.usage, + + --this field is similar to any item definition in minetest + --it just set the image shown then the armor is dropped as an item or inside an inventory + inventory_image = "mcl_armor_inv_elytra.png", + + --this field is used by minetest internally and also by some helper functions + --in order for the tool to be shown is the right creative inventory tab, the right groups should be added + --"mcl_armor_uses" is required to give your armor a durability + --in that case, the armor can be worn by 10 points before breaking + --if you want the armor to be enchantable, you should also add the "enchantability" group, with the highest number the better enchants you can apply + groups = {armor = 1, non_combat_armor = 1, armor_torso = 1, non_combat_torso = 1, mcl_armor_uses = 10}, + + --this table is used by minetest for seraching item specific sounds + --the _mcl_armor_equip and _mcl_armor_unequip are used by the armor implementation to play sounds on equip and unequip + --note that you don't need to provide any file extention + sounds = { + _mcl_armor_equip = "mcl_armor_equip_leather", + _mcl_armor_unequip = "mcl_armor_unequip_leather", + }, + + --these fields should be initialised like that in most cases + --mcl_armor.equip_on_use is a function that try to equip the piece of armor you have in hand inside the right armor slot if the slot is empty + on_place = mcl_armor.equip_on_use, + on_secondary_use = mcl_armor.equip_on_use, + + --this field define that the tool is ACTUALLY an armor piece and in which armor slot you can put it + --it should be set to "head", "torso", "legs" or "feet" + _mcl_armor_element = "torso", + + + --this field is used to provide the texture that will be overlayed on the object (player or mob) skin + --this field can be a texture name or a function that will be called each time the mcl_armor.update(obj) function is called + --see the mcl_armor.register_set() documentation for more explanations + _mcl_armor_texture = "mcl_armor_elytra.png" + + --callbacks + --see the mcl_armor.register_set() documentation for more explanations + + _on_equip = function(obj, itemstack) + end, + _on_unequip = function(obj, itemstack) + end, + _on_break = function(obj) + end, +}) +``` + +## Interacting with Armor of an Entity + +Mods may want to interact with armor of an entity. + +Most global functions not described here may not be stable or may be for internal use only. + +You can equip a piece of armor on an entity inside a mod by using `mcl_armor.equip()`. + +```lua +--itemstack: an itemstack containing the armor piece to equip +--obj: the entity you want to equip the armor on +--swap: boolean, force equiping the armor piece, even if the entity already have one of the same type +mcl_armor.equip(itemstack, obj, swap) +``` + +You can update the entity apparence by using `mcl_armor.update()`. + +This function put the armor overlay on the object's base texture. +If the object is player it will update his displayed armor points count in HUD. + +This function will work both on players and mobs. + +```lua +--obj: the entity you want the apparence to be updated +mcl_armor.update(obj) +``` + +## Handling Enchantments + +Armors can be enchanted in most cases. + +The enchanting part of MineClone2 is separated from the armor part, but closely linked. + +Existing armor enchantments in Minecraft improve most of the time how the armor protect the entity from damage. + +The `mcl_armor.register_protection_enchantment()` function aims to simplificate the creation of such enchants. + +```lua +mcl_armor.register_protection_enchantment({ + --this field is the id that will be used for registering enchanted book and store the enchant inside armor metadata. + --(his internal name) + id = "magic_protection", + + --visible name of the enchant + --this field is used as the name of registered enchanted book and inside armor tooltip + --translation should be added + name = S("Magic Protection"), + + --this field is used to know that the enchant currently do + --translation should be added + description = S("Reduces magic damage."), + + --how many levels can the enchant have + --ex: 4 => I, II, III, IV + --default: 4 + max_level = 4, + + --which enchants this enchant will not be compatible with + --each of these values is a enchant id + incompatible = {blast_protection = true, fire_protection = true, projectile_protection = true}, + + --how much will the enchant consume from the enchantability group of the armor item + --default: 5 + weight = 5, + + --false => the enchant can be obtained in an enchanting table + --true => the enchant isn't obtainable in the enchanting table + --is true, you will probably need to implement some ways to obtain it + --even it the field is named "treasure", it will be no way to find it + --default: false + treasure = false, + + --how much will damage be reduced + --see Minecraft Wiki for more informations + --https://minecraft.gamepedia.com/Armor#Damage_protection + --https://minecraft.gamepedia.com/Armor#Enchantments + factor = 1, + + --restrict damage to one type + --allow the enchant to only protect of one type of damage + damage_type = "magic", + + --restrict damage to one category + --allow to protect from many type of damage at once + --this is much less specific than damage_type and also much more customisable + --the "is_magic" flag is used in the "magic", "dragon_breath", "wither_skull" and "thorns" damage types + --you can checkout the mcl_damage source code for a list of availlable damage types and associated flags + --but be warned that mods can register additionnal damage types + damage_flag = "is_magic", +}) +``` diff --git a/mods/ITEMS/mcl_armor/api.lua b/mods/ITEMS/mcl_armor/api.lua index 8e295827c..2fb56a02f 100644 --- a/mods/ITEMS/mcl_armor/api.lua +++ b/mods/ITEMS/mcl_armor/api.lua @@ -94,7 +94,6 @@ function mcl_armor.register_set(def) local on_unequip_callbacks = def.on_unequip_callbacks or {} local on_break_callbacks = def.on_break_callbacks or {} local textures = def.textures or {} - local previews = def.previews or {} local durabilities = def.durabilities or {} local element_groups = def.element_groups or {} @@ -134,8 +133,7 @@ function mcl_armor.register_set(def) _on_break = on_break_callbacks[name] or def.on_break, _mcl_armor_element = name, _mcl_armor_texture = textures[name] or modname .. "_" .. itemname .. ".png", - _mcl_armor_preview = previews[name] or modname .. "_" .. itemname .. "_preview.png", - _mcl_upgradable = def.upgradable, + _mcl_upgradable = def.upgradable }) if def.craft_material then @@ -222,17 +220,6 @@ function mcl_armor.update(obj) end end - local preview = def._mcl_armor_preview - - if obj:is_player() and preview then - if type(preview) == "function" then - preview = preview(obj, itemstack) - end - if preview then - info.preview = "(player.png^[opacity:0^" .. def._mcl_armor_preview .. ")" .. (info.preview and "^" .. info.preview or "" ) - end - end - info.points = info.points + minetest.get_item_group(itemname, "mcl_armor_points") local mob_range_mob = def._mcl_armor_mob_range_mob @@ -255,8 +242,6 @@ function mcl_armor.update(obj) info.texture = info.texture or "blank.png" if obj:is_player() then - info.preview = info.preview or "blank.png" - mcl_armor.update_player(obj, info) else local luaentity = obj:get_luaentity() diff --git a/mods/ITEMS/mcl_armor/player.lua b/mods/ITEMS/mcl_armor/player.lua index 48fdb381f..99e23efdd 100644 --- a/mods/ITEMS/mcl_armor/player.lua +++ b/mods/ITEMS/mcl_armor/player.lua @@ -63,7 +63,7 @@ mcl_player.player_register_model("mcl_armor_character_female.b3d", { }) function mcl_armor.update_player(player, info) - mcl_player.player_set_armor(player, info.texture, info.preview) + mcl_player.player_set_armor(player, info.texture) local meta = player:get_meta() meta:set_int("mcl_armor:armor_points", info.points) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 703087fc7..7e94580f5 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -276,9 +276,6 @@ function mcl_enchanting.initialize() new_def._mcl_armor_texture = new_def._mcl_armor_texture .. mcl_enchanting.overlay end end - if new_def._mcl_armor_preview and not type(new_def._mcl_armor_preview) == "function" then - new_def._mcl_armor_preview = new_def._mcl_armor_preview .. mcl_enchanting.overlay - end new_def._mcl_enchanting_enchanted_tool = new_name new_def.after_use = get_after_use_callback(itemdef) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 72d0057dc..ddaa49e02 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -120,7 +120,6 @@ pumpkin_face_base_def._mcl_armor_mob_range_factor = 0 pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman" pumpkin_face_base_def._mcl_armor_element = "head" pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png" -pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png" if minetest.get_modpath("mcl_armor") then local pumpkin_hud = {} diff --git a/mods/ITEMS/mcl_farming/textures/mcl_farming_pumpkin_face_preview.png b/mods/ITEMS/mcl_farming/textures/mcl_farming_pumpkin_face_preview.png deleted file mode 100644 index a151fcab6c71ab850dea5ed126d9c79f7f5d89b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!3-pI!a4o{DYF2d5Z6Q?gMnd!oyKAhjm@EI zI}>z{<*Hn&*Nv1Hx;DYQNLPj@kAbh2fvgd%8G=R4^tdBnX66;PvBWGWO}|Z9Tx_dNo1R;IO4h2|z3Kw}s@UHx3v IIVCg!09H9GT>t<8 diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_preview.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_skeleton_preview.png deleted file mode 100644 index 70d6d5cabbb27277c3baebf84e4f444fd3f29227..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt!9f+S=N_zP|bM=UZ7= zBqt{yby$=M6lE+4@(X5gcy=QV$g%KraSW+oOioA;5DE!PVPH&5baggx_PiLtamb*_ zYo^6)i)P7F%MN-av~_iN3(rtolC$K5K@KAWTOzCeCL;!GpcxFFu6{1-oD!M%0FUEE2gkNVZien-Y|Gw1yx#{jgu&C* K&t;ucLK6V%1TXLa diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_wither_skeleton_preview.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_wither_skeleton_preview.png deleted file mode 100644 index dbc9b3629f9ebe4a97ba779b49c154ca44a4677e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNC^e_gt!7}BO@a-Gc#*zYehvx z9UUF(^1>vbC}T;GUoeBivm0qZj)kX-V@L&KazcWDP)Jw`17l*MtFwW#=fwbyLk3M= zGc9IYG)taZcF-%Kt*g6Rc!uJVoFyj=au^xd5?S>(88KJ`&0z3!^>bP0l+XkK+d3%M diff --git a/mods/ITEMS/mcl_heads/textures/mcl_heads_zombie_preview.png b/mods/ITEMS/mcl_heads/textures/mcl_heads_zombie_preview.png deleted file mode 100644 index ff1e0b26c650e9ccbd3ebd903faaf4c4709e1767..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^0zj<5!VDx|E`RzTNJ#|vgt!7}gAj9v440J2DdA1w z(H+q;>aqdO2DMwGcL3!WOM?7@862M7NCR@rJzX3_Dj1U!5(I=ogi;t7T~&ou4V+J0 zy~%kdz>u@i;7ZV)NeW8uR0RYT)x}*6oCP=}+H@HhUe9IYQgr5?1T=!d)78&qol`;+ E08C^lh5!Hn diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index f3e5ad0c3..a06913896 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -95,31 +95,16 @@ local function set_texture(player, index, texture) player:set_properties({textures = textures}) end -local function set_preview(player, field, preview) - player:get_meta():set_string("mcl_player:" .. field .. "_preview", preview) -end - -function mcl_player.player_set_skin(player, texture, preview) +function mcl_player.player_set_skin(player, texture) set_texture(player, 1, texture) - set_preview(player, "skin", preview) end -function mcl_player.player_set_armor(player, texture, preview) +function mcl_player.player_set_armor(player, texture) set_texture(player, 2, texture) - set_preview(player, "armor", preview) end -function mcl_player.player_get_preview(player) - local preview = player:get_meta():get_string("mcl_player:skin_preview") - if preview == "" then - preview = "player.png" - end - local armor_preview = player:get_meta():set_string("mcl_player:armor_preview") - if armor_preview ~= "" then - preview = preview .. "^" .. armor_preview - end - return preview - +function mcl_player.player_set_wielditem(player, texture) + set_texture(player, 3, texture) end function mcl_player.get_player_formspec_model(player, x, y, w, h, fsname) diff --git a/mods/PLAYER/mcl_skins/.gitignore b/mods/PLAYER/mcl_skins/.gitignore new file mode 100644 index 000000000..6edbd2834 --- /dev/null +++ b/mods/PLAYER/mcl_skins/.gitignore @@ -0,0 +1,4 @@ +!textures/mcl_skins_character_1.png +textures/mcl_skins_character_* +!meta/mcl_skins_character_1.txt +meta/mcl_skins_character_* \ No newline at end of file diff --git a/mods/PLAYER/mcl_skins/init.lua b/mods/PLAYER/mcl_skins/init.lua index 6d5461a98..485e342b1 100644 --- a/mods/PLAYER/mcl_skins/init.lua +++ b/mods/PLAYER/mcl_skins/init.lua @@ -3,7 +3,7 @@ local modname = minetest.get_current_modname() mcl_skins = { - skins = {}, list = {}, previews = {}, meta = {}, has_preview = {}, + skins = {}, list = {}, meta = {}, modpath = minetest.get_modpath(modname), skin_count = 0, -- counter of _custom_ skins (all skins except character.png) } @@ -18,10 +18,8 @@ while true do if id == 0 then skin = "character" - mcl_skins.has_preview[id] = true else skin = "mcl_skins_character_" .. id - local preview = "mcl_skins_player_" .. id -- Does skin file exist? f = io.open(mcl_skins.modpath .. "/textures/" .. skin .. ".png") @@ -31,20 +29,12 @@ while true do break end f:close() - - -- Does skin preview file exist? - local file_preview = io.open(mcl_skins.modpath .. "/textures/" .. preview .. ".png") - if file_preview == nil then - minetest.log("warning", "[mcl_skins] Player skin #"..id.." does not have preview image (player_"..id..".png)") - mcl_skins.has_preview[id] = false - else - mcl_skins.has_preview[id] = true - file_preview:close() - end end mcl_skins.list[id] = skin + local metafile + -- does metadata exist for that skin file ? if id == 0 then metafile = "mcl_skins_character.txt" @@ -89,12 +79,11 @@ function mcl_skins.set_player_skin(player, skin_id) return false end local playername = player:get_player_name() - local skin, preview + local skin if skin_id == nil or type(skin_id) ~= "number" or skin_id < 0 or skin_id > mcl_skins.skin_count then return false elseif skin_id == 0 then skin = "character" - preview = "player" mcl_player.player_set_model(player, "mcl_armor_character.b3d") else skin = "mcl_skins_character_" .. tostring(skin_id) @@ -104,16 +93,9 @@ function mcl_skins.set_player_skin(player, skin_id) else mcl_player.player_set_model(player, "mcl_armor_character.b3d") end - if mcl_skins.has_preview[skin_id] then - preview = "mcl_skins_player_" .. tostring(skin_id) - else - -- Fallback preview image if preview image is missing - preview = "mcl_skins_player_dummy" - end end --local skin_file = skin .. ".png" mcl_skins.skins[playername] = skin - mcl_skins.previews[playername] = preview player:get_meta():set_string("mcl_skins:skin_id", tostring(skin_id)) mcl_skins.update_player_skin(player) if has_mcl_inventory then @@ -131,7 +113,7 @@ function mcl_skins.update_player_skin(player) return end local playername = player:get_player_name() - mcl_player.player_set_skin(player, mcl_skins.skins[playername] .. ".png", mcl_skins.previews[playername] .. ".png") + mcl_player.player_set_skin(player, mcl_skins.skins[playername] .. ".png") end -- load player skin on join @@ -259,7 +241,11 @@ function mcl_skins.show_formspec(playername) formspec = formspec .. ";" .. selected .. ";false]" - formspec = formspec .. "image[0,0;1.35,2.7;" .. mcl_skins.previews[playername] .. ".png]" + local player = minetest.get_player_by_name(playername) + if player then + --maybe the function could accept both player object and player name? + formspec = formspec .. mcl_player.get_player_formspec_model(player, 0, 0, 1.35, 2.7, "mcl_skins:skin_select") + end if meta then if meta.name and meta.name ~= "" then diff --git a/mods/PLAYER/mcl_skins/textures/mcl_skins_player_1.png b/mods/PLAYER/mcl_skins/textures/mcl_skins_player_1.png deleted file mode 100644 index 3d7af2a980c2412be1f72e39fd6d7ffeda8f7fb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2625 zcmV-H3cmG;P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3yqa^*MbOT=L03%Wmi{6 z^u#>*NqQ7T5}Anv?e>5EecZqJgkGb|Qd{Yzcs{x39+jKspU-m*KHu~E!++d-Yj^SE zL8K{hP0!D=-~LLwe7#Wf+djUxyE@--+B;DA9Qb~c&20B?zxEE4;?o}9->$#!Y5pag z_Z#Os>^u0+-?;+D62?o>#hpU(oSV&(SV8JZxu$y-I$4|YmFN7|*tzxx@ILQ;VCVI1 zPv4<%zPugE4~*XSAV1pE=QQ!#io(~--yZb!ImK_-owM3G`-x6-0jc8NpguymcXS*; zneJpeP0Bg6?~3pNMGbfJd`+9%|&f`$|Jz0NRMVvajjt})J-Zd*$=_BbyA z*^Y2xg`VY7gR2Q^iRSpZmT>3ocfJ`KGp|6;7#J+@#&3uFtH%H3_#EgQlWqvUJvg;X za5PP`3}epD^n#FZUQFfUdk^=EZu~FACK!|pb0a|Y;~8Q|_|jIoJSX~z&(1%o5$bve z03zlV784Q-_=1>23BJZyLjcDHKg!Bu%5lIz5Q!_e12-uZ$Z65$=A9aD-zf2E##$gk zQb`qRNFd0{S6sE#<&$U{aMb+plkPUJK5lv!q-ZT6`vuCz%1RaSMY zt-f@Jjg)rYvdgZ!?Y{M(wUbUha>}WvoqqI_weY6xH`c-r=Kh|w@Umu%<=d}*u|{*P zA43GQ6EV(UEam{?)fhm~(Kz!hfgAV$s##uyCd9ip7@$=w%of6JSb z{Ev8xe`3xVb^j0MoKg2O_d9QY!P?SWQPL&Ivd}Q~>0oSIW3#^#+mZR)V{Tx^&B}Um z+dgg9Oh)Wc;wVKY;GeV>;0g<((k>xsM&_NZWdKX*E$nr&1d4E1z_B|kUq7y49Vuy* zDM9vhv6eJb+7$p)m)My^Tp+ayG^kCQQ3arF(ZPitNNL zTk#;(1^FrJm}ieArBTUI1d=&82wnfAy;(o|YKwrs{>?a$Ja-^)LG z@o8>rRYU+rCwj^E7Z;><`$OK!N7+^A@8LeoQj2YrVRlP7D{jxrld#`;M}yYMy^0Lg z4ud^FJDHe?%dCAak*i`hC!Uj7MwzlnsXMdg)%vzM(mhi+L-)^kQjm7M)8O^YXxj_< z3}lNlutwY_v=#a>n;J|p_`@zL`%G$e&8mm=-HoMC2{4PE$?vIn5Kj_dH=OG#FN^tC zS{A90C81ldi)I5klzC(ix|KR-W#bU%sB4^=*q8L}up3@r-Ml|1nwjH#Jx<-=nMj0s zG_cW#C~$)gR=ewU7P55j;S!k&4!c#;4+mH-V2J}~8CiGjq}qMD?dgU69X%Cf2`Lu0 zBRsqiHL`4}W)x%uQS)5~Ax+3-8WM#d0nD^j&Z*nBOugJ2{ov?i& z=l!HUH*{>!QrgR5xH_rpq!}H-b)Ll_0-lo?vD&k`4Ac6_mGTCOhNw+0sdiRqK1x8) zTv`v9XR3RiNn{g@ByZfMuw!G%k5r#?=q57rTKiQfBa={>xgwk8?UKvRwql%tvEl#^ zbm7F~XWr1PdCgpyHFK1uLPEv`8jl_JmfnyHzbrULD3< z6l!VKgx5~IVT?N|K34k~s6Nc`7zKVtB1*h1COs$3&tHva4&4iX-(y^8!^~_*+cDtx zLIJy-vUbiOy^B47@HWJeq6n~d|2*&rlWHif3(KN*F<%K!s4s&W4mN7xh>@V0VhuDcevC%4n#j$zc_~%mPM`S|3mGpXbSakk-@>Ydn(w=<0qs8<|&(Si*Y5^mKxs z>r?ECo-Xn426o>@Hf6)tB>&VDn|fdiAO`)k*ldH7uqrCYiHmnOo3U!P7oFIi7Y9+_ z4l!MJdfwwt?2vP6Sev<_p+XeFyw)iIL74GIg_UOhcOBVd1o~EG%4hzBn;i-NzqkvUf zAYsrUqm3dcit1E{pn~X72zB%pm=M?@!h=)?gUCF1us@U+S3IGEmqX6{Zyvmo^sO9gya@0{8@5Dw_ zRUwto%51yZTkS$|tv3vejFL)dJiB+7WJV+4Q&3ffjl`CLKUjVso7F64n=;BG9^OwA`bQ7AUE)aPw%S_LRYGj)^d zPK{2!-_Y zV*u*rUDgi#`}G1FNA^$UmT8yvIz-TOMK1IV%)T{qUU&d@hFhAg`g1+lhQSrkNkJ|8dNM+x{FS2xrx zt=<7+X>)+(m1SGq?!W4zYGz%pZ_2>TRGKZ5$ zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=EHmLn$&h2L34mQa!q63d||I43)p<>x}-fA=Kq z^y7eCP_npyK7m8~^>+_{p-}V~qME0i(uNXq%v{j%?JQ?YTb$4JvRyh4_Q01P7$!k0 z=WA-qzre1y0T!2if3ydyOUIWGU4>_nG4tpzKVL$^r=8Y&$ZK4QciUNCu1j`_Kfgyq zFb;*DaNs5+8=gL95v)M66tps*%EJ<8f7n^#``88lB6!!{Q|z{~?D80ju%+dYo?^7@ zq)&FaPQwo?qT9?5KkR9X+kLreylhu>&-B)EX!gBifxJ9aN}On{B0vB}Q&+XqhX^w7D2(u5uzkrOpNnM-T^z3Tgr~ zU)Mr&-aO~4UQ(7{F|0gm&S8)J;7FDsvBTrB{hlEi=p2L-TVROFB0BFeF-Xbh^F z)YLU=Ns?mHl#-=!M->x`rk2diEn9K%=<3PM-Lsd>S#X7EPT4~CoO3Cdv_QIGbb&`H zJMXf`UH7!x?t9)#Mf%iOwWey-Yp&(sLk=AOBOMkFKk`u;HKbCDOs2Ws?0?)TJaQ5(eK^s^f^n9VK{G_DgJ%s`AIfw&Cal%s3Rvphi0295jf5U~I(N>B{a#?zh~6#&2=sugHag?kC8Ffo_p|<@Sc!QRY92 zOhDrlj+k!Jaj~_+K0ckjYd!n0>auF=xRI9ixoxGbvEhF3i`zHE!t+W#6$|anwmuOH z_xt>QjBaiCH;4b){t@~*5ifwkCt3V1Rl=u7;#n+wdL*93!v8s6FERQFvG5Zo|K%FN zwUxs^GVa87H8c1700006VoOIv0RI600RN!9r;`8x010qNS#tmYE+YT{E+YYWr9XB6 z000McNliru;{yc^2^i)K`62)S06$4YK~zY`V>~mjjsY2Ly#N0{10LY7$jFGyXJVib zj2bW)3}7J?@8|$s{b(SL8Zcb)0(u!YS|*MfFhUIg0F7=Dy0Zh%7ytkO07*qoM6N<$ Eg6UDq0RR91 diff --git a/settingtypes.txt b/settingtypes.txt index 0587438da..077f76c85 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -101,9 +101,6 @@ fire_animation_frames (Fire Animation Frames) int 8 # Whether to animate chests when open / close animated_chests (Animated chests) bool true -# Whether to preview the player in inventory in 3D (requires Minetest 5.4) -3d_player_preview (3D Player preview) bool true - # The maximum number of boss bars to simultaniously display on the screen max_bossbars (Maximum Boss bars) int 5 From 54e9477f37e9c18d403c8e96fc95067d78d3be3c Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Mon, 20 Jun 2022 17:05:18 -0300 Subject: [PATCH 08/11] Fix hopper downpos priority check --- mods/ITEMS/mcl_hoppers/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index e12649cae..278e9d8ea 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -457,8 +457,9 @@ minetest.register_abm({ -- Try to move an item below before moving it sideways local downnode = minetest.get_node(downpos) - if not minetest.registered_nodes[downnode.name] then return end - if mcl_util.move_item_container(pos, downpos) then return end + + if minetest.registered_nodes[downnode.name] and \ + mcl_util.move_item_container(pos, downpos) then return end -- Move an item from the hopper into the container to which the hopper points to local g = get_item_group(frontnode.name, "container") From d57097baefd65c674b3bc9d2ad3067a805876ba3 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Mon, 20 Jun 2022 20:37:15 -0300 Subject: [PATCH 09/11] Fix syntax error with hopper check --- mods/ITEMS/mcl_hoppers/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 278e9d8ea..7ae0a4916 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -458,7 +458,7 @@ minetest.register_abm({ -- Try to move an item below before moving it sideways local downnode = minetest.get_node(downpos) - if minetest.registered_nodes[downnode.name] and \ + if minetest.registered_nodes[downnode.name] and mcl_util.move_item_container(pos, downpos) then return end -- Move an item from the hopper into the container to which the hopper points to From f3cc8f0f8a5b64fdd3abd0d79653b96519a6d21c Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Thu, 23 Jun 2022 14:29:36 -0300 Subject: [PATCH 10/11] Fix get_item_group crash in mcl_hoppers --- mods/ITEMS/mcl_hoppers/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 7ae0a4916..90057ea75 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -1,5 +1,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) +local get_item_group = minetest.get_item_group + --[[ BEGIN OF NODE DEFINITIONS ]] local mcl_hoppers_formspec = From b8f89e5569c16600a5247166f434967d2814ad23 Mon Sep 17 00:00:00 2001 From: Gustavo Ramos Rehermann Date: Thu, 23 Jun 2022 18:23:29 -0300 Subject: [PATCH 11/11] Add missing local definition of var downpos --- mods/ITEMS/mcl_hoppers/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 90057ea75..c8435ce03 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -439,6 +439,7 @@ minetest.register_abm({ front = {x=pos.x,y=pos.y,z=pos.z-1} end local above = {x=pos.x,y=pos.y+1,z=pos.z} + local downpos = {x=pos.x,y=pos.y-1,z=pos.z} local frontnode = minetest.get_node(front) if not minetest.registered_nodes[frontnode.name] then return end