From 710a04ec82045d20f348ffb53a2e5a9edb20904a Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 15 May 2021 22:16:12 +0200 Subject: [PATCH] Render preview banners with transparent patterns correctly Without this fix, the banner pattern preview generation does not mask the banner pattern, so the alpha channel of the banner pattern is not taken into account. This lead to preview banners with color gradients showing up as a solid color banner and opaque pixel artifacts for the bottom triangle pattern. --- mods/ITEMS/mcl_banners/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index 509fb450..e071dc13 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -387,13 +387,15 @@ for colorid, colortab in pairs(mcl_banners.colors) do -- redraw the pattern textures as low-resolution pixel -- art and use that instead. - local layer = "(([combine:20x40:-2,-2="..pattern.."^[resize:16x24^[colorize:"..color..":"..layer_ratio.."))" + local layer = "(([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24^[colorize:" .. color .. ":" .. layer_ratio .. "))" + local mask = "(([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24" .. "))" function escape(text) return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)") end - finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer) + local layer_masked = layer .. "[mask:" .. escape(mask) + finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer_masked) end inv = finished_banner