diff --git a/release-notes.md b/release-notes.md
index d10ce4e1..abcce4d8 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -22,13 +22,14 @@ For players:
* Updated mod compatibility list for Stardew Valley 1.2.
For mod developers:
+* SMAPI now logs basic context info to simplify troubleshooting.
* Added a `Context.IsWorldReady` flag.
- _This is set to `true` when the player has loaded a save and the world is finished initialising. This is set at the same point that `SaveEvents.AfterLoad` and `TimeEvents.AfterDayStarted` are raised, and is mainly useful with events which can be raised before the world is loaded._
-* Added log entries for basic context changes (e.g. loaded save) to simplify troubleshooting.
+ _This flag is true when a save is loaded and the world is finished initialising, which starts at the same point that `SaveEvents.AfterLoad` and `TimeEvents.AfterDayStarted` are raised. This is mainly useful with events which can be raised before the world is loaded (like update tick)._
* Added a `debug` console command to TrainerMod which lets you pass debug commands to the game (e.g. `debug warp FarmHouse 1 1` warps the player to the farmhouse).
* Added a deprecation warning for mods that don't set the `Name`, `Version`, or `UniqueID` manifest fields. These will be required in SMAPI 2.0.
* Mods can now override `Dispose` if they need to release unmanaged resources.
* Deprecated `GameEvents.GameLoaded` and `GameEvents.FirstUpdateTick`, since any logic in the mod's `Entry` method will happen after the game is loaded.
+* Fixed maps not recognising custom tilesheets added through the SMAPI content API.
## 1.12
See [log](https://github.com/Pathoschild/SMAPI/compare/1.11...1.12).
diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs
index 4f3a29fc..a340b995 100644
--- a/src/StardewModdingAPI/Framework/SGame.cs
+++ b/src/StardewModdingAPI/Framework/SGame.cs
@@ -168,7 +168,7 @@ namespace StardewModdingAPI.Framework
private static Stopwatch _fpsStopwatch => SGame.Reflection.GetPrivateField(typeof(Game1), nameof(SGame._fpsStopwatch)).GetValue();
private static float _fps
{
- set { SGame.Reflection.GetPrivateField(typeof(Game1), nameof(_fps)).SetValue(value); }
+ set => SGame.Reflection.GetPrivateField(typeof(Game1), nameof(_fps)).SetValue(value);
}
private static Task _newDayTask => SGame.Reflection.GetPrivateField(typeof(Game1), nameof(_newDayTask)).GetValue();
private Color bgColor => SGame.Reflection.GetPrivateField(this, nameof(bgColor)).GetValue();
@@ -202,6 +202,15 @@ namespace StardewModdingAPI.Framework
SGame.Reflection = reflection;
Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef; // required by Stardew Valley
+
+ // The game uses the default content manager instead of Game1.CreateContentManager in
+ // several cases (See http://community.playstarbound.com/threads/130058/page-27#post-3159274).
+ // The workaround is...
+ // 1. Override the default content manager.
+ // 2. Since Game1.content isn't initialised yet, and we need one main instance to
+ // support custom map tilesheets, detect when Game1.content is being initialised
+ // and use the same instance.
+ this.Content = new SContentManager(this.Content.ServiceProvider, this.Content.RootDirectory, this.Monitor);
}
/****
@@ -212,6 +221,12 @@ namespace StardewModdingAPI.Framework
/// The root directory to search for content.
protected override LocalizedContentManager CreateContentManager(IServiceProvider serviceProvider, string rootDirectory)
{
+ // When Game1.content is being initialised, use SMAPI's main content manager instance.
+ // See comment in SGame constructor.
+ if (Game1.content == null && this.Content is SContentManager mainContentManager)
+ return mainContentManager;
+
+ // build new instance
return new SContentManager(this.Content.ServiceProvider, this.Content.RootDirectory, this.Monitor);
}