0
0
Fork 0

Don't allow anvil repair if already at max health

This commit is contained in:
Wuzzy 2018-02-04 07:36:47 +01:00
parent 146458112c
commit 2f88529d41
1 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ local function update_anvil_slots(meta)
end end
-- Same tool twice -- Same tool twice
if input1:get_name() == input2:get_name() and def1.type == "tool" then if input1:get_name() == input2:get_name() and def1.type == "tool" and (input1:get_wear() > 0 or input2:get_wear() > 0) then
-- Add tool health together plus a small bonus -- Add tool health together plus a small bonus
-- TODO: Combine tool enchantments -- TODO: Combine tool enchantments
local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST) local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST)
@ -89,7 +89,7 @@ local function update_anvil_slots(meta)
elseif material:get_name() == tooldef._repair_material then elseif material:get_name() == tooldef._repair_material then
has_correct_material = true has_correct_material = true
end end
if has_correct_material then if has_correct_material and tool:get_wear() > 0 then
local new_wear = calculate_repair(tool:get_wear(), MAX_WEAR, MATERIAL_TOOL_REPAIR_BOOST) local new_wear = calculate_repair(tool:get_wear(), MAX_WEAR, MATERIAL_TOOL_REPAIR_BOOST)
tool:set_wear(new_wear) tool:set_wear(new_wear)
name_item = tool name_item = tool