From 976cfba53a3a0ddecb9cb549c0026a47545cca50 Mon Sep 17 00:00:00 2001 From: NO411 Date: Fri, 18 Mar 2022 23:02:51 +0100 Subject: [PATCH] Make it possible to xraft a banner on an enchanted shield --- mods/ITEMS/mcl_enchanting/engine.lua | 2 +- mods/ITEMS/mcl_shields/init.lua | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index f8a13292bd..2499cda00e 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -301,7 +301,7 @@ function mcl_enchanting.initialize() end end -function +function mcl_enchanting.random(pr, ...) (pr, ...) local r = pr and pr:next(...) or math.random(...) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index c9ed6eb1e5..4884a2e653 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -397,7 +397,8 @@ minetest.register_craft({ }) for _, colortab in pairs(mcl_banners.colors) do - minetest.register_tool("mcl_shields:shield_" .. colortab[1], { + local color = colortab[1] + minetest.register_tool("mcl_shields:shield_" .. color, { description = S(colortab[6] .. " Shield"), _doc_items_longdesc = S("A shield is a tool used for protecting the player against attacks."), inventory_image = "mcl_shield.png^(mcl_shield_item_overlay.png^[colorize:" .. colortab[4] ..")", @@ -416,12 +417,17 @@ for _, colortab in pairs(mcl_banners.colors) do _shield_color = colortab[4], }) - local banner = "mcl_banners:banner_item_" .. colortab[1] + local banner = "mcl_banners:banner_item_" .. color minetest.register_craft({ type = "shapeless", - output = "mcl_shields:shield_" .. colortab[1], + output = "mcl_shields:shield_" .. color, recipe = {"mcl_shields:shield", banner}, }) + minetest.register_craft({ + type = "shapeless", + output = "mcl_shields:shield_" .. color .. "_enchanted", + recipe = {"mcl_shields:shield_enchanted", banner}, + }) end local function to_shield_texture(banner_texture) @@ -438,7 +444,7 @@ local function craft_banner_on_shield(itemstack, player, old_craft_grid, craft_i for i = 1, player:get_inventory():get_size("craft") do local stack = old_craft_grid[i] local name = stack:get_name() - if name == "mcl_shields:shield" then + if minetest.get_item_group(name, "shield") then shield_stack = stack break end