diff --git a/CraftingGUI.cs b/CraftingGUI.cs index 6cf092f5..d660012f 100644 --- a/CraftingGUI.cs +++ b/CraftingGUI.cs @@ -66,7 +66,7 @@ public static class CraftingGUI private static readonly Dictionary itemCounts = new Dictionary(); private static List recipes = new List(); private static List recipeAvailable = new List(); - private static Recipe selectedRecipe; + public static Recipe selectedRecipe; private static int numRows; private static int displayRows; private static bool slotFocus; diff --git a/MagicStorageConfig.cs b/MagicStorageConfig.cs index e0087d20..d40188e4 100644 --- a/MagicStorageConfig.cs +++ b/MagicStorageConfig.cs @@ -35,6 +35,11 @@ public class MagicStorageConfig : ModConfig [DefaultValue(false)] public bool clearSearchText; + [Label("Clear selected recipe")] + [Tooltip("Enable to clear the last selected recipe when opening the Crafting Interface")] + [DefaultValue(true)] + public bool clearSelectedRecipe; + [Label("Show estimated item dps")] [Tooltip("Enable to show the estimated dps of the item as a tooltip")] [DefaultValue(true)] @@ -52,6 +57,8 @@ public class MagicStorageConfig : ModConfig [JsonIgnore] public static bool ClearSearchText => Instance.clearSearchText; + [JsonIgnore] public static bool ClearSelectedRecipe => Instance.clearSelectedRecipe; + [JsonIgnore] public static bool ShowItemDps => Instance.showItemDps; public override ConfigScope Mode => ConfigScope.ClientSide; diff --git a/StoragePlayer.cs b/StoragePlayer.cs index a7e41cba..8a65a662 100644 --- a/StoragePlayer.cs +++ b/StoragePlayer.cs @@ -138,6 +138,11 @@ public void OpenStorage(Point16 point, bool remote = false) CraftingGUI.searchBar?.Reset(); } + if (MagicStorageConfig.ClearSelectedRecipe) + { + CraftingGUI.selectedRecipe = null; + } + StorageGUI.RefreshItems(); }