Hunting module crashes with LemonLib on world creation
Foreck1 opened this issue ยท 3 comments
Issue Description
Hunting module crashes with LemonLib on world creation
What Happens
- When generating a new world in the modpack Rebirth of the Night using the latest [1.6.0] release candidate along the library mod LemonLib, the game crashes with
java.lang.ClassCastException: com.codetaylor.mc.pyrotech.modules.hunting.capability.SpearEntityData cannot be cast to party.lemons.lemonlib.handler.cooldown.ICooldownHandler
What You Expect to Happen
- The game not to crash.
Script
Crash Log
https://gist.github.com/Foreck1/424540403192e0d5983d1f125aeeddc7
Affected Versions
- Minecraft: 1.12.2
- Forge: 14.23.5.2860
- CraftTweaker: 4.1.20.673
- Dropt:
- Pyrotech: RC 1.6.0
- Athenaeum: 1.19.5
Reproduced minimally: https://gist.github.com/codetaylor/9858ee82ab257397b565dc138a083e92
This has a two-factor causation:
- LemonLib fails to register its capability in the pre-init phase, and
- Pyrotech fails to register its capability in the pre-init phase.
This created a unique case where both the capability reference for LemonLib and Pyrotech is not injected by the CapabilityManager and both references are null. Then, when LemonLib asks for the capability matching its reference, null
, Pyrotech's capability was being returned because its reference was also null
, matching, and it happened to be in the list before LemonLib's capability.
The only reason that LemonLib's capability retrieval works is because it is the only capability reference in your entire mod list that is null
. When it asks for the capability matching null
, its reference is null
and it matches. Pyrotech came along and threw a wrench in the mix by not properly registering its capability, subsequently also matching null
.
In stand-alone testing of Pyrotech, the null
referenced capability worked just fine because, again, it was the only null
referenced capability in the mod list.