AlexModGuy / AlexsMobs

203 stars 155 forks source link

Unbreaking has reduced effect on Tarantula Hawk Elytra #644

Open Zareul opened 3 years ago

Zareul commented 3 years ago

A regular Elytra with Unbreaking III seems to be lasting longer than a Tarantula Hawk Elytra with the same enchantment. I discovered this after noticing that, after upgrading my Elytra to a Tarantula Hawk one, durability drained faster than before I "upgraded" it.

I've uploaded a video of this behaviour: Watch the video

Psithief commented 2 years ago

https://github.com/Alex-the-666/AlexsMobs/blob/4b7aafac950c0aaba5ddef6c692aafc0678eaf0a/src/main/java/com/github/alexthe666/alexsmobs/item/ItemTarantulaHawkElytra.java#L52-L57

It seems to need to check for Unbreaking here.

raqbit commented 2 years ago

https://github.com/Alex-the-666/AlexsMobs/blob/4b7aafac950c0aaba5ddef6c692aafc0678eaf0a/src/main/java/com/github/alexthe666/alexsmobs/item/ItemTarantulaHawkElytra.java#L52-L57

It seems to need to check for Unbreaking here.

I checked this in more detail, and it appears the code for applying unbreaking (DigDurabilityEnchantment#shouldIgnoreDurabilityDrop) is giving more chance for armor to get damaged, even with Unbreaking.

Because Elytra does not extend ArmorItem, there's only a 1 in (unbreaking lvl + 1) chance it takes damage every second, whereas the tarantula hawk elytra has an extra 60% chance to take damage.

If the probability calculator I'm using is correct, this means that with Unbreaking 3, the elytra has a 25% chance of getting damage each second and the tarantula hawk elytra has a 70% chance to take damage every second.