1
0
Fork 0

add armor trim color support

This commit is contained in:
chmodsayshello 2023-06-07 21:01:55 +02:00
parent ed5232411b
commit bc3da8dab8
1 changed files with 32 additions and 29 deletions

View File

@ -1,7 +1,7 @@
mcl_armor_trims = { mcl_armor_trims = {
blacklisted = {["mcl_farming:pumpkin_face"]=true, ["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, blacklisted = {["mcl_farming:pumpkin_face"]=true, ["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true},
overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire"}, overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire"},
colors = {"bf352d"} colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}
} }
local function define_items() local function define_items()
@ -9,36 +9,39 @@ local function define_items()
for itemname, itemdef in pairs(minetest.registered_tools) do for itemname, itemdef in pairs(minetest.registered_tools) do
if itemdef._mcl_armor_texture and type(itemdef._mcl_armor_texture) == "string" and not mcl_armor_trims.blacklisted[itemname] then if itemdef._mcl_armor_texture and type(itemdef._mcl_armor_texture) == "string" and not mcl_armor_trims.blacklisted[itemname] then
for _, overlay in pairs(mcl_armor_trims.overlays) do for _, overlay in pairs(mcl_armor_trims.overlays) do
local new_name = itemname .. "_trimmed_" .. overlay for mineral, color in pairs(mcl_armor_trims.colors) do
minetest.override_item(itemname, {_mcl_armor_trims_trim = new_name}) local new_name = itemname .. "_trimmed_" .. overlay .. "_" .. mineral
local new_def = table.copy(itemdef) minetest.override_item(itemname, {_mcl_armor_trims_trim = new_name})
local new_def = table.copy(itemdef)
local piece_overlay = overlay local piece_overlay = overlay
local invOverlay = "" local invOverlay = ""
if string.find(itemname,"helmet") then if string.find(itemname,"helmet") then
invOverlay = "^helmet_trim.png" invOverlay = "^(helmet_trim.png"
piece_overlay = piece_overlay .. "_helmet" piece_overlay = piece_overlay .. "_helmet"
elseif string.find(itemname,"chestplate") then elseif string.find(itemname,"chestplate") then
invOverlay = "^chestplate_trim.png" invOverlay = "^(chestplate_trim.png"
piece_overlay = piece_overlay .. "_chestplate" piece_overlay = piece_overlay .. "_chestplate"
elseif string.find(itemname,"leggings") then elseif string.find(itemname,"leggings") then
invOverlay = "^leggings_trim.png" invOverlay = "^(leggings_trim.png"
piece_overlay = piece_overlay .. "_leggings" piece_overlay = piece_overlay .. "_leggings"
elseif string.find(itemname,"boots") then elseif string.find(itemname,"boots") then
invOverlay = "^boots_trim.png" invOverlay = "^(boots_trim.png"
piece_overlay = piece_overlay .. "_boots" piece_overlay = piece_overlay .. "_boots"
end
invOverlay = invOverlay .. "^[colorize:" .. color .. ")"
piece_overlay = piece_overlay .. ".png"
new_def.groups.not_in_creative_inventory = 0 --set this to 1 later!
new_def.groups.not_in_craft_guide = 1
new_def._mcl_armor_texture = new_def._mcl_armor_texture .. "^(" .. piece_overlay .. "^[colorize:" .. color .. ")"
new_def.inventory_image = itemdef.inventory_image .. invOverlay
new_def._mcl_armor_trims_trim = new_name
register_list[":" .. new_name] = new_def
end end
piece_overlay = piece_overlay .. ".png"
new_def.groups.not_in_creative_inventory = 0 --set this to 1 later!
new_def.groups.not_in_craft_guide = 1
new_def._mcl_armor_texture = new_def._mcl_armor_texture .. "^(" .. piece_overlay .. "^[colorize:purple)"
new_def.inventory_image = itemdef.inventory_image .. invOverlay
new_def._mcl_armor_trims_trim = new_name
register_list[":" .. new_name] = new_def
end end
end end
end end