theishiopian / Parrying

A mod about deflecting blows (and inflicting your own)
6 stars 5 forks source link

Incompatibility with Dungeons Gear Dual Crossbow #53

Closed Thelnfamous1 closed 1 year ago

Thelnfamous1 commented 1 year ago

When a user uses both our mods together, the game crashes when the Dual Crossbow is held.

https://github.com/Infamous-Misadventures/Dungeons-Gear/issues/213

I've pinpointed the issue to this line of code (and the equivalent one for the offhand weapon) not verifying to see if the weapon even has an attack speed attribute (our dual crossbows don't). I suspect a similar crash would also occur if our other non-melee weapons are held.

https://github.com/theishiopian/Parrying/blob/b4b39eb92a778c9d663b2225b5f9c700c6f3a6a9/src/main/java/com/theishiopian/parrying/Mixin/PlayerMixin.java#L27

It appears to be a simple fix by checking if the attribute is on each of the weapons before getting them, you can change the "get().getAmount()" calls to "map(modifier -> modifier.getAmount()).orElse(0)".

Thelnfamous1 commented 1 year ago

It's worth noting we have recognized that the issue is triggered on our end because we accidentally added attack damage attribute to all of our ranged weapons, which causes them to pass your "isWeapon" check. Still, I would either implement the above change and/or also check that the item has an attack speed attribute in "isWeapon".

theishiopian commented 1 year ago

Thanks, I'll add this to the next release.

theishiopian commented 1 year ago

Done! Thanks for the excellent bug report, I apologize for the delay.