Better Combat [Fabric & Forge]

Better Combat [Fabric & Forge]

35M Downloads

Divide by zero crash with certain Weapon Attributes

Closed this issue ยท 3 comments

commented

Minecraft version - 1.21.1
Mod loader - Fabric
Mod version - 2.1.3
I am using the latest version available - Yes!

Describe the bug
Some weapon attributes containers seem to cause a crash, instead of being sanitized/marked as invalid.

An example is Simply Swords' Soulrender:
https://github.com/Sweenus/SimplySwords/blob/c81638c2fe0b3d9effe90352eeb5536ba118f20b/common/src/main/resources/data/simplyswords/weapon_attributes/soulrender.json

To Reproduce
Steps to reproduce the behavior:

  1. Install Simply Swords and Better Combat
  2. Equip a Soulrender
  3. Equip an item (with no weapon attributes) in your offhand
  4. Crash

Crash report
https://mclo.gs/lZHow7h

Additional Info
The divide by zero seems to be referring to this modulo:

Changing the last two NO_OFFHAND_ITEM attacks in the example json to NOT_DUAL_WIELDING fixes the crash, so maybe this is caused by the weapon having no valid attacks available? In that case, I still think it should be sanitized/fall back/have no weapon attributes.

commented

(After some more thought, this is probably best, just putting it on here for ease of tracking)

Image

commented

I am unable to reproduce the issue.

It would help a lot if you could give feedback, whether this commit fixed the issue.

Posted on built Jar also Discord pre-release channel

commented

I can test it shortly!