codetaylor / pyrotech-1.12

An early game mod with new primitive devices, combustion machines, smelting mechanics, storage options, tools, torches, advancements, and absolutely zero GUIs -- with exception to the substantially complete, mostly illustrated, and charred guidebook.
https://pyrotech.readthedocs.io/en/latest/
Other
52 stars 19 forks source link

Hunting module crashes with LemonLib on world creation #384

Closed Foreck1 closed 2 years ago

Foreck1 commented 2 years ago

Issue Description

Hunting module crashes with LemonLib on world creation

What Happens

What You Expect to Happen

Script

-

Crash Log

https://gist.github.com/Foreck1/424540403192e0d5983d1f125aeeddc7

Affected Versions

codetaylor commented 2 years ago

Reproduced minimally: https://gist.github.com/codetaylor/9858ee82ab257397b565dc138a083e92

codetaylor commented 2 years ago

This has a two-factor causation:

  1. LemonLib fails to register its capability in the pre-init phase, and
  2. 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.

codetaylor commented 2 years ago

Fixed in 1.12.2-1.6.0-RC2