forked from VoxeLibre/VoxeLibre
Don't add player velocity if mob velocity is the same or greater to avoid projectile-like knockbacks
This commit is contained in:
parent
0955b9981b
commit
1f826b6224
|
@ -720,8 +720,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
local hv = hitter:get_velocity()
|
local hv = hitter:get_velocity()
|
||||||
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
-- add player velocity to mob knockback
|
-- add player velocity to mob knockback
|
||||||
if (dir.x > 0 and hv.x > 0) or (dir.x < 0 and hv.x < 0) then
|
if (dir.x > 0 and hv.x > 0 and v.x <= hv.x) or (dir.x < 0 and hv.x < 0 and v.x >= hv.x) then
|
||||||
if (dir.z > 0 and hv.z > 0) or (dir.z < 0 and hv.z < 0) then
|
if (dir.z > 0 and hv.z > 0 and v.z <= hv.z) or (dir.z < 0 and hv.z < 0 and v.z >= hv.z) then
|
||||||
kb = kb + ((math.abs(hv.x) + math.abs(hv.z)) * r)
|
kb = kb + ((math.abs(hv.x) + math.abs(hv.z)) * r)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue