From 038156bcbf4533aceaff7e06ecf7f6c2712e2c7f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 27 Jul 2017 23:09:48 +0200 Subject: [PATCH] Add banner pattern overlay code (unused atm) --- mods/ITEMS/mcl_banners/init.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index e1b1cbf2d3..44a3fa2222 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -40,13 +40,32 @@ local on_destruct_standing_banner = function(pos) end end -local make_banner_texture = function(colorid) +local make_banner_texture = function(base_color, layers) local colorize - if colors[colorid] then - colorize = colors[colorid][4] + if colors[base_color] then + colorize = colors[base_color][4] end if colorize then - return { "(mcl_banners_banner_base.png^[mask:mcl_banners_base_inverted.png)^((mcl_banners_banner_base.png^[colorize:"..colorize..")^[mask:mcl_banners_base.png)" } + -- Base texture with base color + local base = "(mcl_banners_banner_base.png^[mask:mcl_banners_base_inverted.png)^((mcl_banners_banner_base.png^[colorize:"..colorize..")^[mask:mcl_banners_base.png)" + + -- Optional pattern layers + -- TODO: Add entity support + if layers then + local finished_banner = base + for l=1, #layers do + local layerinfo = layers[l] + local pattern = layerinfo.pattern .. ".png" + local color = colors[layerinfo.color][4] + + -- Generate layer texture + local layer = "(("..pattern.."^[colorize:"..color..")^[mask:"..pattern..")" + + finished_banner = finished_banner .. "^" .. layer + end + return { finished_banner } + end + return { base } else return { "mcl_banners_banner_base.png" } end