diff options
-rw-r--r-- | docs/release-notes.md | 8 | ||||
-rw-r--r-- | src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs | 18 |
2 files changed, 22 insertions, 4 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index e73b90fb..837f31db 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,7 +8,13 @@ --> ## Upcoming release -* Fixed launcher's fallback logic on Linux when no compatible terminal was found (thanks to jlaw!). +* For players: + * Fixed launcher's fallback logic on Linux when no compatible terminal was found (thanks to jlaw!). + +* For the Console Commands mod: + * Fixed error opening menu when some item data is invalid. + * Fixed spawned Floor TV not functional as a TV (thanks to Platonymous!). + * Fixed incorrect color for sturgeon roe. ## 3.6.1 Released 21 June 2020 for Stardew Valley 1.4.1 or later. diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 6a17213c..37f5f8d1 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -77,7 +77,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework // furniture foreach (int id in this.TryLoad<int, string>("Data\\Furniture").Keys) { - if (id == 1466 || id == 1468) + if (id == 1466 || id == 1468 || id == 1680) yield return this.TryCreate(ItemType.Furniture, id, () => new TV(id, Vector2.Zero)); else yield return this.TryCreate(ItemType.Furniture, id, () => new Furniture(id, Vector2.Zero)); @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework SObject input = this.TryCreate(ItemType.Object, -1, () => new SObject(pair.Key, 1))?.Item as SObject; if (input == null || input.Category != SObject.FishCategory) continue; - Color color = TailoringMenu.GetDyeColor(input) ?? Color.Orange; + Color color = this.GetRoeColor(input); // yield roe SObject roe = null; @@ -259,12 +259,24 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { try { - return new SearchableItem(type, id, createItem()); + var item = createItem(); + item.getDescription(); // force-load item data, so it crashes here if it's invalid + return new SearchableItem(type, id, item); } catch { return null; // if some item data is invalid, just don't include it } } + + /// <summary>Get the color to use a given fish's roe.</summary> + /// <param name="fish">The fish whose roe to color.</param> + /// <remarks>Derived from <see cref="StardewValley.Buildings.FishPond.GetFishProduce"/>.</remarks> + private Color GetRoeColor(SObject fish) + { + return fish.ParentSheetIndex == 698 // sturgeon + ? new Color(61, 55, 42) + : (TailoringMenu.GetDyeColor(fish) ?? Color.Orange); + } } } |