MoriyaShiine / aylyth

In the midst of the journey of our life, I found myself in a dark wood without paths. The Wood is known as Aylyth.
https://www.curseforge.com/minecraft/mc-mods/aylyth
Other
3 stars 7 forks source link

Shucking a mob still drops its normal drops #63

Closed cybercat5555 closed 10 months ago

cybercat5555 commented 10 months ago

Mod version

aylyth-1.19.2-2.0.1

A description of the issue

When you shuck a mob that has drops, i.e. a cow, it will still drop those when shucked but will also be put into the fruit. It should not produce the mob drops if shucked.

Log or crash report

n/a

dhyces commented 10 months ago

The problem is that if you have strength or anything that increases the damage you deal, the entity is killed before the postHit method is called and before the PreventDrops component is set by YmpeDaggerItem#postHit. This is also an issue for entities that have very low health, since the dagger deals 1 damage on its own. A possible fix would be to inject a "preHit" type of method to items to allow handling before a hit, returning an enum to continue or cancel the method at that point. This brings up a question. "postHit" is only ever called by PlayerEntity#attack, meaning players are the only entities that would ever be able to shuck other entities. Do we want to allow zombies holding a shucked ympe fruit in their offhand and an ympe dagger in their main hand to shuck other entities when they attack?