Wizard Armour appears to provide significantly more protection than intended
Tora-B opened this issue ยท 4 comments
Minecraft version: 1.12.2
Wizardry version: 4.1.1
Issue details: The stats on the tooltip appear to be correct for regular wizard armour, but when equipped, the player gains twice as much armour rating as comparable armour. The tooltip for Legendary wizard armour appears to be wrong, displaying the same amount of armour as the regular wizard armour, and provides more than twice as much armour rating when equipped.
It's difficult to measure damage taken because the range of values is so small, but it does not appear to be wildly wrong, so it may just be a visual problem. When equipping or unequipping the armour, some of the armour icons appear, and after a brief delay, the remainder appear, so it may be due to setting the various armour stats in multiple places. There have been significant changes to how armour works since 1.7, and many mods have had similar issues.
Here's what each piece appears to be applying, separated into the initial armour value plus the additional amount that appears a moment later. Note that each armour point is half an icon.
Hat: 2 + 2
Robes: 4 + 4
Leggings: 5 + 5
Boots: 2 + 2
Legendary:
Hat: 2 + 3
Robes: 4 + 8
Leggings: 5 + 6
Boots: 2 + 3
The additional armour value added appears to be the correct amount, as in the case of the Legendary wizard armour, it matches the base values of Diamond armor.
Ooooook, I see now that this has been... partially fixed in 8360e52, but that just hasn't been pushed to a release. No wonder I've been pulling my hair out, trying to figure out how the code in the repo could possibly be producing the results I'm seeing. I think there are a few issues with the commit, which I may attempt to tackle later.
Ok thanks for all this information. The armour code is old and clearly hasn't survived the port from 1.7.10 very well! I want to try and fix some more bugs before releasing a patch with those changes, just haven't had the time until now. I'll be testing the changes from that PR anyway to check everything works as it's supposed to.
Like I said, many mods have had similar issues, due to the introduction of the armor and toughness attributes in 1.9, and some changes to ISpecialArmor that have gone unnoticed. Actually, the current state of the repo makes the problem arguably worse -- instead of just incorrectly displaying more armor than it provides, the current changes actually double up the protection, because both the attributes and ISpecialArmor#getProperties() are providing full protection. Apparently in the past, using ISpecialArmor meant the normal Minecraft armor mechanics and stats were ignored for that item, but some changes on Forge's end in the past year have made that no longer the case, and both are applied.
There are basically three ways to handle this, depending on what you actually want your armor to do.
-
Cut the attributes entirely, and depend on ISpecialArmor. This does mean you'll no longer get armor stats on the item tooltip, but you can add them yourself if you desire. You'll also need to use getArmorDisplay() to make the armor show up on the HUD. This is basically what you had before the recent commits -- all you needed to do was strip the armor attributes off. This was Vazkii's solution for Botania. Do consider that this means the item takes considerably more durability damage than the vanilla system unless you handle it. In vanilla, items take 1 damage for every 4 incoming damage, but DamageArmor passes the full value to you, with the intention that you handle whatever scaling is appropriate, since it's primarily intended for items that do not use the normal durability mechanics. While you've rebranded durability as Mana, you've only given wizard armour durability equivalent to iron, so it will be used up four times as fast.
-
Drop ISpecialArmor entirely. The reasons for its existence are mostly no longer relevant, unless you want to respond differently to different kinds of damage. Improvements to both vanilla and Forge have largely rendered it irrelevant. You're not really using it, since you're not doing anything special in getProperties() or DamageArmor(), just mimicking the old vanilla damage formula. To handle only providing protection while the item has mana, just strip out the attributes if it's empty, and to handle Legendary status, tack on a separate armor modifier if the tag is there.
-
Handle base armor with attributes, and handle special damage reduction with ISpecialArmor, if you want to do things like resistance to particular spells or elements. Mostly the same as the second option, you just need to make sure you're not duplicating the base protection in getProperties().
Thanks for your explanation. I believe I used ISpecialAmor primarily to allow rendering of the custom model. If that is still necessary, I'll go for the third solution, but if not it might make sense to ditch ISpecialArmor entirely.
Nope, that's actually in Item, not ISpecialArmor. Guess I'll be dropping ISpecialArmor then - I might do resistance to specific elements or whatever in future, but I'd probably sooner do it using events anyway.