[Bug 1.12.2] Protection Enchants are Multiplied
Ameranth opened this issue ยท 5 comments
Hello and thank you for your work!
I've done some lengthy tests with First Aid and all protection enchantments; it seems to be the case that First Aid is multiplying their damage reduction in some way, which results in the player becoming far more durable than normal.
The easiest way to test this is with head/chest death off, and one armor piece (I used leather boots) that has Feather Falling IV on it. With First Aid enabled you can fall far more blocks before dying, compared to the same setup with First Aid off. Protection IV in the same scenario yields similar results
I also tested this with Protection IV on a single item (leather boots, and other slots with leather armor unenchanted) against a single zombie wielding an iron shovel. The zombie struck me for 4 - 4.5 hearts on each hit, unless he struck my feet, at which point it was only 1 -1.5 hearts of damage (far less than the intended 16% reduction from Protection IV).
Again, thank you for your work and your time!
This is somewhat intended. You see, FirstAid only takes the enchantment of the body part that was hit into account. This means you take full damage on unprotected parts, but it multiplies the value of protection by 4 when the part with the protection has been hit (to account for it only calucating the enchantment on 1/4th of the armor). I can see that this can be a problem with some enchantments (as feather falling) though, as it is only possible to get feather falling on the feet. But I am not sure what the correct solution to this is right now. If you have a suggestion on how to handle this, feel free to post a suggestion here.
Thanks for the reply, that explanation makes sense!
As to the suggestion, I'll preface with saying that I have no idea what things can or can't be done, so I apologize if I suggest something impossible. Also note that it seems to be case that any hit which deals enough to damage multiple body parts at once will receive the multiplied reduction for each "slot" hit. In the context of vanilla this probably never happens outside of falling, but it is very achievable with scaling/mob mods. That being said:
-
Instead of multiplying protection values by 4, it might be best to only use the sum of a protection enchant's levels that the player has equipped (like vanilla). I.e. if I have protection IV on my boots and protection II on legs, and I suffer a hit to boots or legs, consider it as protection 6, and apply no protection if I am struck in the body/head as usual for First Aid. This should help preserve intended protection maximums, especially when modded enchantment rules are in-play, and also helps preserve the work necessary to achieve peak protection.
-
Alternate to above, which is maybe simpler: only multiply protection values by the maximum number of slots the enchant can appear on--so just 1 for feather fall, 4 for others, but this may be problematic with modded enchantment rules.
-
Address big hits, which damage multiple "slots" at once; the damage going on each slot should be reduced only by the protection on that slot, such that the total reduction is never more than can be achieved without First Aid.
Thank you for your time!
Thanks for the suggestions. I fixed that multi-slot damage would cause armor to be applied multiple times. Regarding suggestion 2, it's sadly not possible to safely determine if a certain slot can have an enchament or not. I could hardcode it for vanilla, but mods would break.
I've also implemented suggestion 1, but disabled it by default using a config setting. While it is the most accurate when it comes to damage reduction compared to vanilla, it kinda opposes the locational armor that is used otherwise, as enchantments are global with that setting (if you have protection 4 on boots and nowhere else, if you have a helment it will apply it to that as well)
Fixed in 1.6.15 beta for mc 1.12.2. If no bigger issues arise, this will be promoted to a release soon, and a version for 1.16 will follow.
That's amazing to hear, thank you!
Regarding suggestion 1; I think the most important part of it was that it handles limited-slot enchants being multiplied (like Feather Fall). Also, I had meant that the sum of enchantment levels would be used only if the slot hit also had the enchant (no idea if this is possible). So if you have Protection 4 on boots and legs, but none on helmet or chest, it doesn't apply to hits on head/body--conversely, it would grant the reduction of Protection 8 when struck on boots/legs. So it's a bit of a compromise between vanilla and First Aid styles.
But I can't thank you enough, you've already done more than I would have hoped for.