1
0
Fork 0

Knockback

This commit is contained in:
Lizzy Fleckenstein 2020-11-04 12:00:42 +01:00
parent 2b55dac7d2
commit cdafb1a07e
1 changed files with 11 additions and 1 deletions

View File

@ -219,7 +219,7 @@ mcl_enchanting.enchantments.infinity = {
requires_tool = false,
}
-- unimplemented
-- implemented via minetest.calculate_knockback
mcl_enchanting.enchantments.knockback = {
name = "Knockback",
max_level = 2,
@ -234,6 +234,16 @@ mcl_enchanting.enchantments.knockback = {
requires_tool = false,
}
local old_calculate_knockback = minetest.calculate_knockback
function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
local knockback = old_calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
if hitter and hitter:is_player() then
local wielditem = hitter:get_wielded_item()
knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
end
return knockback
end
-- unimplemented
mcl_enchanting.enchantments.looting = {
name = "Looting",