1
0
Fork 0

Add maximum pvp knockback limit & approximate enchant knockback distance to be similar to MC

This commit is contained in:
Eliy21 2023-12-14 11:57:55 +00:00
parent bf9e487fa9
commit 6b439fd1de
1 changed files with 5 additions and 1 deletions

View File

@ -282,7 +282,7 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
end end
if hitter and hitter:is_player() and distance <= 3 then if hitter and hitter:is_player() and distance <= 3 then
local wielditem = hitter:get_wielded_item() local wielditem = hitter:get_wielded_item()
knockback = knockback + 5 * mcl_enchanting.get_enchantment(wielditem, "knockback") knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
-- add vertical lift to knockback -- add vertical lift to knockback
local v = player:get_velocity() local v = player:get_velocity()
if v and v.y <= 0.1 and v.y >= -0.1 and dir.y <= 0.44 then if v and v.y <= 0.1 and v.y >= -0.1 and dir.y <= 0.44 then
@ -304,6 +304,10 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then
knockback = knockback + hitter_mag * 0.375 knockback = knockback + hitter_mag * 0.375
end end
-- add maximum knockback limit
if knockback > 12.875 then
knockback = 12.875
end
elseif hitter and hitter:is_player() and distance > 3 then elseif hitter and hitter:is_player() and distance > 3 then
knockback = 0 knockback = 0
elseif luaentity and luaentity._knockback then elseif luaentity and luaentity._knockback then