Closed Crimix closed 2 years ago
@lehjr Have you missed this PR?
@lehjr Have you missed this PR?
Not so much. Haven't had much of a chance to even look at it. Currently I'm working on the new GUI's.
I ended up manually applying this since it was quicker than resolving conflicts. I'm probably going to have to apply the same fix in multiple locations before the next release.
That's fine. I have not looked for other places, but I guess more places could use the same bump in robustness
This mod caused a crash with one of my mods by making an unsafe cast see Crimix/jetboots#23.
java.lang.ClassCastException: com.black_dog20.jetboots.common.util.EnchantableItemHandler cannot be cast to com.github.lehjr.numina.util.capabilities.inventory.modularitem.IModularItem
I think it was caused by line 110-111 because of how the logic statement was evaluated as
( (iModularItem instanceof IModularItem) && ((IModularItem) iModularItem).isModuleOnline(MPSRegistryNames.JETPACK_MODULE_REGNAME) ) || ((IModularItem) iModularItem).isModuleOnline(MPSRegistryNames.GLIDER_MODULE_REGNAME)
instead of(iModularItem instanceof IModularItem) && ( ((IModularItem) iModularItem).isModuleOnline(MPSRegistryNames.JETPACK_MODULE_REGNAME) || ((IModularItem) iModularItem).isModuleOnline(MPSRegistryNames.GLIDER_MODULE_REGNAME) )
This PR fixes the issue by using the filter and map methods of the LazyOptional to cast the Item handler to IModularItem thus making the code more robust
Fixes Crimix/jetboots#23