diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index 444d06689d..f829d2e876 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -328,6 +328,8 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i local b2meta = banner2:get_meta() local b1layers_raw = b1meta:get_string("layers") local b2layers_raw = b2meta:get_string("layers") + local b1name = b1meta:get_string("name") + local b2name = b2meta:get_string("name") local b1layers = minetest.deserialize(b1layers_raw) local b2layers = minetest.deserialize(b2layers_raw) if type(b1layers) ~= "table" then @@ -339,17 +341,19 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i -- For copying to be allowed, one banner has to have no layers while the other one has at least 1 layer. -- The banner with layers will be used as a source. - local src_banner, src_layers_raw, src_desc, src_index, src_has_name - if #b1layers == 0 and #b2layers > 0 then + local src_banner, src_layers, src_layers_raw, src_desc, src_index, src_has_name + if #b1layers == 0 and b1name == "" and #b2layers > 0 then src_banner = banner2 + src_layers = b2layers src_layers_raw = b2layers_raw - src_desc = b2meta:get_string("description") + src_desc = minetest.registered_items[src_banner:get_name()].description src_has_no_name = b2meta:get_string("name") == "" src_index = banner2_index - elseif #b2layers == 0 and #b1layers > 0 then + elseif #b2layers == 0 and b2name == "" and #b1layers > 0 then src_banner = banner + src_layers = b1layers src_layers_raw = b1layers_raw - src_desc = b1meta:get_string("description") + src_desc = minetest.registered_items[src_banner:get_name()].description src_has_no_name = b1meta:get_string("name") == "" src_index = banner_index else @@ -359,10 +363,8 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i -- Set output metadata local imeta = itemstack:get_meta() imeta:set_string("layers", src_layers_raw) - -- Keep description if banner has a name - if src_has_no_name then - imeta:set_string("description", src_desc) - end + -- Generate new description. This clears any (anvil) name from the original banners. + imeta:set_string("description", mcl_banners.make_advanced_banner_description(src_layers)) if not craft_predict then -- Don't destroy source banner so this recipe is a true copy