1
0
Fork 0

Fix enchanting shield on enchanting table possible

dyable-leather-armor
NO411 2022-03-18 22:45:12 +01:00
parent 0f8f5a41d2
commit 60d877b718
2 changed files with 9 additions and 5 deletions

View File

@ -74,8 +74,12 @@ function mcl_enchanting.is_enchanted(itemname)
return minetest.get_item_group(itemname, "enchanted") > 0 return minetest.get_item_group(itemname, "enchanted") > 0
end end
function mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
return mcl_enchanting.get_enchantability(itemname) == -1
end
function mcl_enchanting.is_enchantable(itemname) function mcl_enchanting.is_enchantable(itemname)
return mcl_enchanting.get_enchantability(itemname) > 0 return mcl_enchanting.get_enchantability(itemname) > 0 or mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
end end
function mcl_enchanting.can_enchant_freshly(itemname) function mcl_enchanting.can_enchant_freshly(itemname)
@ -328,7 +332,7 @@ end
function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr) function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_level, treasure, no_reduced_bonus_chance, ignore_already_enchanted, pr)
local itemname = itemstack:get_name() local itemname = itemstack:get_name()
if not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted then if (not mcl_enchanting.can_enchant_freshly(itemname) and not ignore_already_enchanted) or mcl_enchanting.not_enchantable_on_enchanting_table(itemname) then
return return
end end
@ -454,7 +458,7 @@ function mcl_enchanting.generate_random_table_slots(itemstack, num_bookshelves)
end end
function mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves) function mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves)
if not mcl_enchanting.can_enchant_freshly(itemstack:get_name()) then if (not mcl_enchanting.can_enchant_freshly(itemstack:get_name())) or mcl_enchanting.not_enchantable_on_enchanting_table(itemname) then
return {false, false, false} return {false, false, false}
end end
local itemname = itemstack:get_name() local itemname = itemstack:get_name()

View File

@ -30,7 +30,7 @@ minetest.register_tool("mcl_shields:shield", {
groups = { groups = {
shield = 1, shield = 1,
weapon = 1, weapon = 1,
enchantability = 1, enchantability = -1,
no_wieldview = 1, no_wieldview = 1,
offhand_item = 1, offhand_item = 1,
}, },
@ -405,7 +405,7 @@ for _, colortab in pairs(mcl_banners.colors) do
groups = { groups = {
shield = 1, shield = 1,
weapon = 1, weapon = 1,
enchantability = 1, enchantability = -1,
no_wieldview = 1, no_wieldview = 1,
not_in_creative_inventory = 1, not_in_creative_inventory = 1,
offhand_item = 1, offhand_item = 1,