mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Unbreaking for Bows
This commit is contained in:
parent
04d8d999e2
commit
a516eccd6d
@ -460,7 +460,7 @@ mcl_enchanting.enchantments.thorns = {
|
|||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- implemented via on_enchant; Unimplemented for Bows, Armor and Fishing Rods
|
-- for tools & weapons implemented via on_enchant; for bows implemented in mcl_bows, unimplemented Armor and Fishing Rods
|
||||||
mcl_enchanting.enchantments.unbreaking = {
|
mcl_enchanting.enchantments.unbreaking = {
|
||||||
name = "Unbreaking",
|
name = "Unbreaking",
|
||||||
max_level = 3,
|
max_level = 3,
|
||||||
|
@ -237,7 +237,12 @@ controls.register_on_release(function(player, key, time)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if has_shot and not minetest.is_creative_enabled(player:get_player_name()) then
|
if has_shot and not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
wielditem:add_wear(65535/BOW_DURABILITY)
|
local durability = BOW_DURABILITY
|
||||||
|
local unbreaking = mcl_enchanting.get_enchantment(wielditem, "unbreaking")
|
||||||
|
if unbreaking > 0 then
|
||||||
|
durability = durability * (unbreaking + 1)
|
||||||
|
end
|
||||||
|
wielditem:add_wear(65535/durability)
|
||||||
end
|
end
|
||||||
player:set_wielded_item(wielditem)
|
player:set_wielded_item(wielditem)
|
||||||
reset_bow_state(player, true)
|
reset_bow_state(player, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user