From ee4d1efaa5394887930a4cf9c8cdf7e93d177737 Mon Sep 17 00:00:00 2001 From: goodspeed Date: Fri, 16 Aug 2024 22:03:01 +0200 Subject: [PATCH] Turn 8 snow layers stacked together into snow block (fixes #4483) (#4591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4591 Reviewed-by: Mikita Wiśniewski Co-authored-by: goodspeed Co-committed-by: goodspeed --- mods/ITEMS/mcl_core/nodes_base.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index db2561082..28e83a7a7 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -1051,7 +1051,15 @@ for i=1,8 do local itemstring = itemstack:get_name() local itemcount = itemstack:get_count() local fakestack = ItemStack(itemstring.." "..itemcount) - fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g))) + if i+g < 8 then + fakestack:set_name("mcl_core:snow_"..(i+g)) + else + -- To stack `mcl_core:snow_8', just replacing it with `mcl_core:snowblock' Issue#4483 + if i+g == 9 then + fakestack:set_count(itemcount + 1) + end + fakestack:set_name("mcl_core:snowblock") + end itemstack = minetest.item_place(fakestack, placer, pointed_thing) minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = pointed_thing.under}, true) itemstack:set_name(itemstring)