[BUG/ISSUE] ArmorMaterials should implement all 4 potential armor types, even if unused
Thodor12 opened this issue ยท 0 comments
Before submitting the issue
- I have checked that the bug is not a duplicate or, if it is, it needs to be reopened
- I have checked that I am running the latest version of Queen Bee Mod
- I have checked the FAQ section for solutions
- I have read the contributing guidelines and I agree with the Code of Conduct
Minecraft Version
1.20.1
Describe the bug
QBArmorMaterials -> Antenna has only implemented the armor value for the helmet. This causes the public int getDefenseForType()
method to crash with a nullpointer upon attempting to fetch any other value than a helmet.
This method returns an int and thus is not allowed to be nullable by design, meaning the implementation must, for every possible input, ensure it can output any value, otherwise unboxing will result in a failure.
From our mod (Minecolonies) we attempt to gather the total armor level of a set to categorize it into 1 of 5 levels, we iterate all armor types for this, causing a nullpointer due to lacking information from your armor materials.
Crash log here: https://gist.github.com/samexit/85986580499dfb5b212958be595e7ffd
To Reproduce
Steps to reproduce the behavior:
- Install Minecolonies + dependencies and QueenBee
- Setup a colony + build a guardtower
- Hire a guard and wait for them to request armor
- View the clipboard item to see the request for the armor, which results in a crash
Expected behavior
Mod should not result in a crash
Screenshots
N/A
Latest Log
https://gist.github.com/samexit/b4adae726001e19f840e6b5ec3c3331b
Additional context
N/A