forked from MineClone5/MineClone5
Fix anvil duplication glitch
This commit is contained in:
parent
87e4bed630
commit
0a5b1e75d0
|
@ -101,14 +101,14 @@ local function update_anvil_slots(meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
local can_combine = mcl_enchanting.combine(input1, input2)
|
local can_combine = mcl_enchanting.combine(input1, input2)
|
||||||
|
|
||||||
if can_combine then
|
if can_combine then
|
||||||
-- Add tool health together plus a small bonus
|
-- Add tool health together plus a small bonus
|
||||||
if def1.type == "tool" and def2.type == "tool" then
|
if def1.type == "tool" and def2.type == "tool" then
|
||||||
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)
|
||||||
input1:set_wear(new_wear)
|
input1:set_wear(new_wear)
|
||||||
end
|
end
|
||||||
|
|
||||||
name_item = input1
|
name_item = input1
|
||||||
new_output = name_item
|
new_output = name_item
|
||||||
-- Tool + repair item
|
-- Tool + repair item
|
||||||
|
@ -318,11 +318,11 @@ local anvildef = {
|
||||||
_mcl_after_falling = damage_anvil_by_falling,
|
_mcl_after_falling = damage_anvil_by_falling,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local meta2 = meta
|
local meta2 = meta:to_table()
|
||||||
meta:from_table(oldmetadata)
|
meta:from_table(oldmetadata)
|
||||||
drop_anvil_items(pos, meta)
|
drop_anvil_items(pos, meta)
|
||||||
meta:from_table(meta2:to_table())
|
meta:from_table(meta2)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
Loading…
Reference in New Issue