2023-06-07 15:41:53 +02:00
|
|
|
mcl_armor_trims = {
|
2023-06-07 16:42:34 +02:00
|
|
|
blacklisted = {["mcl_farming:pumpkin_face"]=true, ["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true},
|
2023-06-07 15:41:53 +02:00
|
|
|
overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire"},
|
2023-06-07 21:01:55 +02:00
|
|
|
colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}
|
2023-06-07 15:41:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
local function define_items()
|
|
|
|
local register_list = {}
|
2023-06-07 17:12:02 +02:00
|
|
|
for itemname, itemdef in pairs(minetest.registered_tools) do
|
2023-06-07 16:42:34 +02:00
|
|
|
if itemdef._mcl_armor_texture and type(itemdef._mcl_armor_texture) == "string" and not mcl_armor_trims.blacklisted[itemname] then
|
2023-06-07 15:41:53 +02:00
|
|
|
for _, overlay in pairs(mcl_armor_trims.overlays) do
|
2023-06-07 21:01:55 +02:00
|
|
|
for mineral, color in pairs(mcl_armor_trims.colors) do
|
|
|
|
local new_name = itemname .. "_trimmed_" .. overlay .. "_" .. mineral
|
|
|
|
local new_def = table.copy(itemdef)
|
|
|
|
|
|
|
|
local piece_overlay = overlay
|
|
|
|
local invOverlay = ""
|
|
|
|
if string.find(itemname,"helmet") then
|
|
|
|
invOverlay = "^(helmet_trim.png"
|
|
|
|
piece_overlay = piece_overlay .. "_helmet"
|
|
|
|
elseif string.find(itemname,"chestplate") then
|
|
|
|
invOverlay = "^(chestplate_trim.png"
|
|
|
|
piece_overlay = piece_overlay .. "_chestplate"
|
|
|
|
elseif string.find(itemname,"leggings") then
|
|
|
|
invOverlay = "^(leggings_trim.png"
|
|
|
|
piece_overlay = piece_overlay .. "_leggings"
|
|
|
|
elseif string.find(itemname,"boots") then
|
|
|
|
invOverlay = "^(boots_trim.png"
|
|
|
|
piece_overlay = piece_overlay .. "_boots"
|
|
|
|
end
|
|
|
|
|
2023-06-07 22:49:04 +02:00
|
|
|
invOverlay = invOverlay .. "^[colorize:" .. color .. ":150)"
|
2023-06-07 21:01:55 +02:00
|
|
|
piece_overlay = piece_overlay .. ".png"
|
|
|
|
|
2023-06-07 22:49:04 +02:00
|
|
|
new_def.groups.not_in_creative_inventory = 1
|
2023-06-07 21:01:55 +02:00
|
|
|
new_def.groups.not_in_craft_guide = 1
|
2023-06-07 22:49:04 +02:00
|
|
|
new_def._mcl_armor_texture = new_def._mcl_armor_texture .. "^(" .. piece_overlay .. "^[colorize:" .. color .. ":150)"
|
2023-06-07 21:01:55 +02:00
|
|
|
new_def.inventory_image = itemdef.inventory_image .. invOverlay
|
|
|
|
|
2023-06-07 22:27:52 +02:00
|
|
|
if string.find(itemname, "_enchanted") then
|
|
|
|
new_def._mcl_enchanting_enchanted_tool = new_name
|
|
|
|
else
|
|
|
|
new_def._mcl_enchanting_enchanted_tool = itemname .. "_enchanted_trimmed_" .. overlay .. "_" .. mineral
|
|
|
|
end
|
2023-06-07 21:01:55 +02:00
|
|
|
register_list[":" .. new_name] = new_def
|
2023-06-07 17:06:53 +02:00
|
|
|
end
|
2023-06-07 15:41:53 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for new_name, new_def in pairs(register_list) do
|
2023-06-07 15:58:28 +02:00
|
|
|
minetest.register_tool(new_name, new_def)
|
2023-06-07 15:41:53 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_on_mods_loaded(define_items)
|