From 5d8f85fa5b71638981d4c200d936aee11b9d4927 Mon Sep 17 00:00:00 2001 From: Katie Durden Date: Wed, 8 Mar 2023 20:04:23 -0800 Subject: [PATCH] Separated tile file loading from StaticTiles constructor --- stardew-access/Features/StaticTiles.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index dbd441d..6a9a50e 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -16,6 +16,12 @@ namespace stardew_access.Features if (MainClass.ModHelper is null) return; + if (staticTilesData is null) LoadTilesFiles(); + this.SetupTilesDicts(); + } + + public static void LoadTilesFiles() + { try { using (StreamReader file = new(Path.Combine(MainClass.ModHelper.DirectoryPath, "assets", "static-tiles.json"))) @@ -51,9 +57,7 @@ namespace stardew_access.Features { MainClass.InfoLog($"custom-tiles.json file not found or an error occured while initializing custom-tiles.json\nThe path of the file should be:\n\t{Path.Combine(MainClass.ModHelper.DirectoryPath, "assets", "custom-tiles.json")}"); } - this.SetupTilesDicts(); } - public static bool IsAvailable(string locationName) { List allData = new();