mirror of
https://github.com/OMGeeky/ItemChecklist.git
synced 2025-12-26 16:07:43 +01:00
Fix mod not loading when magic storage isn't loaded
This commit is contained in:
@@ -13,6 +13,7 @@ namespace ItemChecklist
|
||||
// Here we show a few pitfalls that might cause a TypeInitializationException to be thrown.
|
||||
// Remember, you have to gate all access to Types and Methods defined in the weakly referenced mod or it will crash.
|
||||
// All calls to methods in this class by this mod besides Load and Unload are gated with a check to Enabled.
|
||||
[JITWhenModsEnabled("MagicStorage")]
|
||||
static class MagicStorageIntegration
|
||||
{
|
||||
// Here we store a reference to the MagicStorage Mod instance. We can use it for many things.
|
||||
@@ -47,7 +48,7 @@ namespace ItemChecklist
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
MagicStorage = ModLoader.GetMod("MagicStorage");
|
||||
ModLoader.TryGetMod("MagicStorage", out MagicStorage);
|
||||
if (Enabled)
|
||||
//MagicStorageIntegrationMembers.tile = null; // Will also crash. Here even though Enabled will be false, the Type of tile will still need to be resolved when this method runs.
|
||||
//members = new MagicStorageIntegrationMembers(); // Even thought the Type StorageAccess is hidden behind MagicStorageIntegrationMembers, this line will also cause MagicStorageIntegrationMembers and consequently StorageAccess to need to be resolved.
|
||||
|
||||
Reference in New Issue
Block a user