Compare commits
29 Commits
master
...
armor_trim
Author | SHA1 | Date |
---|---|---|
chmodsayshello | 64bc57c6a4 | |
chmodsayshello | d346aa07ee | |
chmodsayshello | 9d1840f4ca | |
chmodsayshello | 5cc9038169 | |
chmodsayshello | 460ef23b50 | |
chmodsayshello | 1e16647fe9 | |
chmodsayshello | 16415ae577 | |
chmodsayshello | 2665980007 | |
chmodsayshello | bb2ce9ef92 | |
chmodsayshello | bc29e4dd95 | |
chmodsayshello | b76ed92aba | |
chmodsayshello | 703f1f46fc | |
chmodsayshello | 0b118c170e | |
chmodsayshello | 8431ac34d0 | |
chmodsayshello | 049128972f | |
chmodsayshello | 0c65d9d11a | |
chmodsayshello | 311beeb31c | |
chmodsayshello | bc3da8dab8 | |
chmodsayshello | ed5232411b | |
chmodsayshello | 6c6a27320d | |
chmodsayshello | 82f2f4784e | |
chmodsayshello | 8476865ea7 | |
chmodsayshello | b4273af245 | |
chmodsayshello | 483285a612 | |
chmodsayshello | b154f2def1 | |
chmodsayshello | c62195662c | |
chmodsayshello | 4dc5ad3bdb | |
chmodsayshello | cc186cc588 | |
chmodsayshello | df8c9625e4 |
|
@ -175,6 +175,7 @@
|
|||
* Faerraven / Michieal
|
||||
* Nicu
|
||||
* Exhale
|
||||
* Aeonix_Aeon
|
||||
|
||||
## Translations
|
||||
* Wuzzy
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
mcl_armor_trims = {
|
||||
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"},
|
||||
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 register_list = {}
|
||||
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
|
||||
for _, overlay in pairs(mcl_armor_trims.overlays) do
|
||||
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
|
||||
|
||||
invOverlay = invOverlay .. "^[colorize:" .. color .. ":150)"
|
||||
piece_overlay = piece_overlay .. ".png"
|
||||
|
||||
new_def.groups.not_in_creative_inventory = 1
|
||||
new_def.groups.not_in_craft_guide = 1
|
||||
new_def._mcl_armor_texture = new_def._mcl_armor_texture .. "^(" .. piece_overlay .. "^[colorize:" .. color .. ":150)"
|
||||
new_def.inventory_image = itemdef.inventory_image .. invOverlay
|
||||
|
||||
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
|
||||
register_list[":" .. new_name] = new_def
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for new_name, new_def in pairs(register_list) do
|
||||
minetest.register_tool(new_name, new_def)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_mods_loaded(define_items)
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/templates.lua")
|
|
@ -0,0 +1,2 @@
|
|||
# textdomain: mcl_armor_trims
|
||||
Smithing Template '@1'=Schiedevorlage '@1'
|
|
@ -0,0 +1,2 @@
|
|||
# textdomain: mcl_armor_trims
|
||||
Smithing Template '@1'
|
|
@ -0,0 +1,4 @@
|
|||
name = mcl_armor_trims
|
||||
author = chmodsayshello
|
||||
optional_depends = mcl_armor
|
||||
depends = mcl_enchanting, mcl_core, mcl_end
|
|
@ -0,0 +1,46 @@
|
|||
local mod_registername = minetest.get_current_modname() .. ":"
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
for _, template_name in pairs(mcl_armor_trims.overlays) do
|
||||
minetest.register_craftitem(mod_registername .. template_name, {
|
||||
description = S("Smithing Template '@1'", template_name),
|
||||
inventory_image = template_name .. "_armor_trim_smithing_template.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_registername .. template_name .. " 2",
|
||||
recipe = {
|
||||
{"mcl_core:diamond",mod_registername .. template_name,"mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:cobble","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
--temp craft recipies, missing structures
|
||||
minetest.register_craft({
|
||||
output = mod_registername .. "eye",
|
||||
recipe = {
|
||||
{"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_end:ender_eye","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_registername .. "ward",
|
||||
recipe = {
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:apple_gold_enchanted","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = mod_registername .. "snout",
|
||||
recipe = {
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"},
|
||||
{"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"},
|
||||
}
|
||||
})
|
|
@ -6,7 +6,7 @@ local S = minetest.get_translator("mcl_smithing_table")
|
|||
mcl_smithing_table = {}
|
||||
|
||||
-- Function to upgrade diamond tool/armor to netherite tool/armor
|
||||
function mcl_smithing_table.upgrade_item(itemstack)
|
||||
function mcl_smithing_table.upgrade_item_netherite(itemstack)
|
||||
local def = itemstack:get_definition()
|
||||
|
||||
if not def or not def._mcl_upgradable then
|
||||
|
@ -39,10 +39,12 @@ local formspec = "size[9,9]" ..
|
|||
mcl_formspec.get_itemslot_bg(0,4.5,9,3) ..
|
||||
"list[current_player;main;0,7.74;9,1;]" ..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1) ..
|
||||
"list[context;diamond_item;1,2.5;1,1;]" ..
|
||||
"list[context;upgrade_item;1,2.5;1,1;]" ..
|
||||
mcl_formspec.get_itemslot_bg(1,2.5,1,1) ..
|
||||
"list[context;netherite;4,2.5;1,1;]" ..
|
||||
"list[context;mineral;4,2.5;1,1;]" ..
|
||||
mcl_formspec.get_itemslot_bg(4,2.5,1,1) ..
|
||||
"list[context;template;5,2.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(5,2.5,1,1)..
|
||||
"list[context;upgraded_item;8,2.5;1,1;]" ..
|
||||
mcl_formspec.get_itemslot_bg(8,2.5,1,1) ..
|
||||
"label[3,0.1;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Upgrade Gear"))) .. "]" ..
|
||||
|
@ -51,12 +53,49 @@ local formspec = "size[9,9]" ..
|
|||
"listring[context;input]"..
|
||||
"listring[current_player;main]"
|
||||
|
||||
local smithing_materials = {
|
||||
["mcl_nether:netherite_ingot"] = "netherite",
|
||||
["mcl_core:diamond"] = "diamond",
|
||||
["mcl_core:lapis"] = "lapis",
|
||||
["mcl_amethyst:amethyst_shard"] = "amethyst",
|
||||
["mesecons:wire_00000000_off"] = "redstone",
|
||||
["mcl_core:iron_ingot"] = "iron",
|
||||
["mcl_core:gold_ingot"] = "gold",
|
||||
["mcl_copper:copper_ingot"] = "copper",
|
||||
["mcl_core:emerald"] = "emerald",
|
||||
["mcl_nether:quartz"] = "quartz"
|
||||
}
|
||||
|
||||
function mcl_smithing_table.upgrade_trimmed(itemstack, color_mineral, template)
|
||||
--get information required
|
||||
local material_name = color_mineral:get_name()
|
||||
material_name = smithing_materials[material_name]
|
||||
|
||||
local overlay = template:get_name():gsub("mcl_armor_trims:","")
|
||||
|
||||
--trimming process
|
||||
itemstack:set_name(itemstack:get_name() .. "_trimmed_" .. overlay .. "_" .. material_name)
|
||||
tt.reload_itemstack_description(itemstack)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
function mcl_smithing_table.is_smithing_mineral(itemname)
|
||||
return smithing_materials[itemname] ~= nil
|
||||
end
|
||||
|
||||
local function reset_upgraded_item(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local upgraded_item
|
||||
local original_itemname = inv:get_stack("upgrade_item", 1):get_name()
|
||||
local template_present = inv:get_stack("template",1):get_name() ~= ""
|
||||
local is_armor = original_itemname:find("mcl_armor:") ~= nil
|
||||
local is_trimmed = original_itemname:find("_trimmed") ~= nil
|
||||
|
||||
if inv:get_stack("netherite", 1):get_name() == "mcl_nether:netherite_ingot" then
|
||||
upgraded_item = mcl_smithing_table.upgrade_item(inv:get_stack("diamond_item", 1))
|
||||
if inv:get_stack("mineral", 1):get_name() == "mcl_nether:netherite_ingot" and not template_present then
|
||||
upgraded_item = mcl_smithing_table.upgrade_item_netherite(inv:get_stack("upgrade_item", 1))
|
||||
elseif template_present and is_armor and not is_trimmed and mcl_smithing_table.is_smithing_mineral(inv:get_stack("mineral", 1):get_name()) then
|
||||
upgraded_item = mcl_smithing_table.upgrade_trimmed(inv:get_stack("upgrade_item", 1),inv:get_stack("mineral", 1),inv:get_stack("template", 1))
|
||||
end
|
||||
|
||||
inv:set_stack("upgraded_item", 1, upgraded_item)
|
||||
|
@ -86,13 +125,24 @@ minetest.register_node("mcl_smithing_table:table", {
|
|||
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
inv:set_size("diamond_item", 1)
|
||||
inv:set_size("netherite", 1)
|
||||
inv:set_size("upgrade_item", 1)
|
||||
inv:set_size("mineral", 1)
|
||||
inv:set_size("template",1)
|
||||
inv:set_size("upgraded_item", 1)
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "diamond_item" and mcl_smithing_table.upgrade_item(stack) or listname == "netherite" and stack:get_name() == "mcl_nether:netherite_ingot" then
|
||||
if
|
||||
listname == "upgrade_item"
|
||||
and string.find(stack:get_name(),"mcl_armor:") -- allow any armor piece to go in (in case the player wants to trim them)
|
||||
and not mcl_armor_trims.blacklisted[stack:get_name()]
|
||||
|
||||
or listname == "mineral"
|
||||
and mcl_smithing_table.is_smithing_mineral(stack:get_name())
|
||||
|
||||
or listname == "template"
|
||||
and string.find(stack:get_name(),"mcl_armor_trims")
|
||||
then
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
|
@ -115,8 +165,9 @@ minetest.register_node("mcl_smithing_table:table", {
|
|||
end
|
||||
|
||||
if listname == "upgraded_item" then
|
||||
take_item("diamond_item")
|
||||
take_item("netherite")
|
||||
take_item("upgrade_item")
|
||||
take_item("mineral")
|
||||
take_item("template")
|
||||
|
||||
-- ToDo: make epic sound
|
||||
minetest.sound_play("mcl_smithing_table_upgrade", {pos = pos, max_hear_distance = 16})
|
||||
|
@ -143,3 +194,8 @@ minetest.register_craft({
|
|||
{"group:wood", "group:wood", ""}
|
||||
}
|
||||
})
|
||||
|
||||
-- this is the exact same as mcl_smithing_table.upgrade_item_netherite , in case something relies on the old function
|
||||
function mcl_smithing_table.upgrade_item(itemstack)
|
||||
return mcl_smithing_table.upgrade_item_netherite(itemstack)
|
||||
end
|
|
@ -1,2 +1,2 @@
|
|||
name = mcl_smithing_table
|
||||
depends = mcl_colors, mcl_formspec
|
||||
depends = mcl_colors, mcl_formspec, mcl_armor_trims
|
||||
|
|
|
@ -188,6 +188,7 @@ mcl_structures.register_structure("nether_bulwark",{
|
|||
stacks_max = 1,
|
||||
items = {
|
||||
{ itemstring = "mcl_compass:lodestone" },
|
||||
{ itemstring = "mcl_armor_trims:rib" },
|
||||
}
|
||||
}}
|
||||
},
|
||||
|
|
|
@ -69,6 +69,7 @@ mcl_structures.register_structure("desert_temple",{
|
|||
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, },
|
||||
{ itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||
{ itemstring = "mcl_armor_trims:dune", weight = 20, amount_min = 2, amount_max = 2},
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ mcl_structures.register_structure("end_shipwreck",{
|
|||
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
|
||||
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_armor_trims:spire", amount_min = 1, amount_max = 1 },
|
||||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||
end },
|
||||
|
|
|
@ -38,6 +38,7 @@ mcl_structures.register_structure("jungle_temple",{
|
|||
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
|
||||
{ itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||
{ itemstring = "mcl_armor_trims:wild", amount_min = 1, amount_max = 1, },
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ mcl_structures.register_structure("pillager_outpost",{
|
|||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
|
||||
end },
|
||||
{ itemstring = "mcl_armor_trims:sentry"},
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ mcl_structures.register_structure("shipwreck",{
|
|||
{ itemstring = "mcl_clock:clock", weight = 1, amount_min = 1, amount_max = 1 },
|
||||
{ itemstring = "mcl_compass:compass", weight = 1, amount_min = 1, amount_max = 1 },
|
||||
{ itemstring = "mcl_maps:empty_map", weight = 1, amount_min = 1, amount_max = 1 },
|
||||
|
||||
{ itemstring = "mcl_armor_trims:coast", weight = 20, amount_min = 2, amount_max = 2},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ mcl_structures.register_structure("woodland_cabin",{
|
|||
{ itemstring = "mcl_armor:chestplate_chain", weight = 1, },
|
||||
{ itemstring = "mcl_armor:chestplate_diamond", weight = 1, },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||
{ itemstring = "mcl_armor_trims:vex", amount_max = 1, },
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 126 B |
After Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 221 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 382 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 256 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 301 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 262 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 300 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 141 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 167 B |
After Width: | Height: | Size: 278 B |
After Width: | Height: | Size: 169 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 283 B |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 328 B |