Better Combat [Fabric & Forge]

Better Combat [Fabric & Forge]

28M Downloads

Attacking crashes when the offhand's attributes are null

MindFaer opened this issue ยท 2 comments

commented

Minecraft version - 1.20.1
Mod loader - Forge 47.2.32
Mod version - 1.8.5+1.20.1-forge
I am using the latest version available - Yes, for 1.20.1

Describe the bug
If you give a weapon attribute of {} to a an item you would like to blacklist, it works normally in the main hand, but if you swing with a one handed weapon with the other item in the offhand, the game crashes.

To Reproduce
Steps to reproduce the behavior:

  1. Make a datapack that gives any item attributes from a .json file containing just {}
  2. Give yourself that item and a one-handed weapon, the item that has the new attributes won't use better combat's animations if it was before
  3. Put the item in your offhand and the one-handed weapon in your main hand, attack, and the game crashes
  4. Error: java.lang.NullPointerException: Cannot invoke "net.bettercombat.api.AttackHand.attack()" because "hand" is null

Expected behavior
Currently, in your discord server, the way people have been blacklisting items is by using a file with just {} in it, so that people who download a mod/datapack don't have to change their config and the .json does it for them. All it should do is swing as if the item in the offhand was a blacklisted item

Additional context
crash-2024-05-27_22.44.50-client.txt
latest.log

commented

Forgot to mention, the json can be fully blank, or just contain {}, I somehow forgot it could be blank and still cause this

commented

Use correct JSON please.
Validator will be improved in the future.