(suggestion) More reasonable knockback resistance in DamageAction
afoxxvi opened this issue ยท 4 comments
When attacked, an entity with a knockback resistance of 0.7 will be knock-backed by only 30%.
There is a knockback_resistance attribute in DamageAction
, by now damage action directly changes the entity's knockback resistance to the attribute value temporarily, which may make an entity to be knock-backed easier if the attribute value is lower than the entity's original attribute.
I know there might be some misunderstanding, for, in my opinion, the new knockback resistance attribute should be set to 1-(1-origin)(1-parameter)
, for example, using a spell with a knockback rate of 40%(the knockback parameter is 0.6) to attack an entity with a knockback resistance of 70%(70% of knockback is blocked), the final knockback rate is 40%*(1-70%)=12%, so the entity's knockback resistance should be set to 0.88.
Maybe in your design, this parameter is used to redefine the entity's knockback attribute, but since Minecraft changed the effect of this attribute in 1.16, I believe some changes should be made.
I'm sorry, I'm not fully understanding what you're saying. It may help me if you could reference from somewhere how the knockback attribute changed in 1.16?
For your specific request, you can read the current knockback_resistance value via a variable (knockback_resistance
), so could you use that in an equation to get the result you're looking for?
You can see the following info at https://minecraft.wiki/w/Java_Edition_1.16, maybe search is needed.
Knockback resistance
Is now a scale of the amount of knockback taken instead of a probability to take no knockback.
Another link is here: https://minecraft.wiki/w/Attribute, at the 4th row of the first table.
The scale of horizontal knockback resisted from attacks and projectiles. Vertical knockback is not affected. Does not affect explosions. 1.0 is 100% knockback resistance. 0.4 means 60% of knockback is applied.
But thanks for introducing variable, it's a valid solution. You may close this issue if you think nothing should be changed.
I have implemented this suggestion and here's my pull request: #1294, which won't affect current effects.