fix location snapshot not updated for removed chests

This commit is contained in:
Jesse Plamondon-Willard 2020-01-01 00:22:29 -05:00
parent 844efa32d4
commit c5cfcc6c9f
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 4 additions and 5 deletions

View File

@ -63,13 +63,12 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
this.TerrainFeatures.Update(watcher.TerrainFeaturesWatcher);
// chest inventories
foreach (var pair in watcher.ChestWatchers)
this.ChestItems.Clear();
foreach (ChestTracker tracker in watcher.ChestWatchers.Values)
{
ItemStackChange[] changes = pair.Value.GetInventoryChanges().ToArray();
ItemStackChange[] changes = tracker.GetInventoryChanges().ToArray();
if (changes.Length > 0)
this.ChestItems[pair.Value.Chest] = changes;
else
this.ChestItems.Remove(pair.Value.Chest);
this.ChestItems[tracker.Chest] = changes;
}
}
}