hawkfalcon/Stardew-Mods

Seeing a stack trace periodically with the 3.0 code

Closed this issue · 3 comments

[02:36:24 ERROR game] An error occurred in the base update loop: System.Collections.Generic.KeyNotFoundException: The given key '00000000-0000-0000-0000-000000000000' was not present in the dictionary.
at BetterJunimos.Utils.Util.GetHutFromId(Guid id)
at BetterJunimos.Patches.PatchPathfindToRandomSpotAroundHut.Postfix(JunimoHarvester __instance, NetGuid& ___netHome)
at StardewValley.Characters.JunimoHarvester.pathfindToRandomSpotAroundHut_PatchedBy<com.hawkfalcon.BetterJunimos>(JunimoHarvester this)
at StardewValley.Characters.JunimoHarvester..ctor(GameLocation location, Vector2 position, JunimoHut hut, Int32 whichJunimoNumberFromThisHut, Nullable1 c) at BetterJunimos.Utils.Util.SpawnJunimoAtPosition(GameLocation location, Vector2 pos, JunimoHut hut, Int32 junimoNumber) at BetterJunimos.Abilities.VisitGreenhouseAbility.PerformAction(GameLocation location, Vector2 pos, JunimoHarvester junimo, Guid guid) at BetterJunimos.Patches.PatchTryToHarvestHere.Prefix(JunimoHarvester __instance, Int32& ___harvestTimer, NetGuid& ___netHome) at StardewValley.Characters.JunimoHarvester.tryToHarvestHere_PatchedBy<com.hawkfalcon.BetterJunimos>(JunimoHarvester this) at StardewValley.Pathfinding.PathFindController.moveCharacter(GameTime time) at StardewValley.Pathfinding.PathFindController.update(GameTime time) at StardewValley.Character.update(GameTime time, GameLocation location, Int64 id, Boolean move) at StardewValley.Character.update(GameTime time, GameLocation location) at StardewValley.NPC.update(GameTime time, GameLocation location) at StardewValley.Characters.JunimoHarvester.update_PatchedBy<com.hawkfalcon.BetterJunimos>(JunimoHarvester this, GameTime time, GameLocation location) at StardewValley.GameLocation.updateCharacters(GameTime time) at StardewValley.GameLocation.updateEvenIfFarmerIsntHere(GameTime time, Boolean ignoreWasUpdatedFlush) at StardewValley.Game1._UpdateLocation(GameLocation location, GameTime time) at StardewValley.Game1.<>c__DisplayClass707_0.<UpdateLocations>b__0(GameLocation location) at StardewValley.Utility.ForEachLocation(Func2 action, Boolean includeInteriors, Boolean includeGenerated)
at StardewValley.Game1.UpdateLocations(GameTime time)
at StardewValley.Game1._update(GameTime gameTime)
at StardewValley.Game1.Update(GameTime gameTime)
at StardewModdingAPI.Framework.SCore.OnPlayerInstanceUpdating(SGame instance, GameTime gameTime, Action runUpdate)

This is likely caused because the junimo in question doesn't have a currently valid home. In that case, the get hut from ID utility crashes.

I also suspect there are issues due to the new logic for handling buildings at non-farm locations... This might be part of why greenhouse logic no longer works correctly

I proposed a possible solution to this at #28

Closing as I merged #28