Changes

→‎Mod entry: expand info on what you can do in Entry
Line 13: Line 13:     
==Mod entry==
 
==Mod entry==
The main mod project must have a subclass of <tt>StardewModdingAPI.Mod</tt>. The class is often named <tt>ModEntry</tt> by convention, but you can use any valid C# name. The class must implement an <tt>Entry</tt> method, which SMAPI will call once the mod is loaded. The <tt>IModHelper helper</tt> argument provides access to nearly all [[Modding:Modder Guide/APIs|SMAPI APIs]], but you can access it via <tt>this.Helper</tt> in other methods.
+
The main mod project must have a subclass of <tt>StardewModdingAPI.Mod</tt>. The class is often named <tt>ModEntry</tt> by convention, but you can use any valid C# name. The class must implement an <tt>Entry</tt> method, which SMAPI will call once the mod is loaded. The <tt>IModHelper helper</tt> argument provides access to nearly all [[Modding:Modder Guide/APIs|SMAPI APIs]] (available as <tt>this.Helper</tt> in other methods).
    
Here's the minimum possible implementation (which does nothing at all):
 
Here's the minimum possible implementation (which does nothing at all):
Line 31: Line 31:  
</source>
 
</source>
   −
This is a good place to [[Modding:Modder Guide/APIs/Config|read configuration]], [[Modding:Modder Guide/APIs/Events|register event handlers]], and [[Modding:Modder Guide/APIs/Content|load mod assets]]. This is called after all mods are loaded (so <tt>helper.ModRegistry.GetAll()</tt> will return all mods), but it may be called very early in the process before the game is initialised. You should use events like <tt>GameLaunched</tt>, <tt>SaveLoaded</tt>, or <tt>DayStarted</tt> if you need initialised game data.
+
The <tt>Entry</tt> method is called very early in the launch process, so some things aren't initialised yet. You can use events like <tt>GameLaunched</tt>, <tt>SaveLoaded</tt>, or <tt>DayStarted</tt> to access all features. Here's a quick summary of using APIs in <tt>Entry</tt>:
 +
{| class="wikitable"
 +
|-
 +
! feature
 +
! status
 +
|-
 +
| most SMAPI APIs
 +
| ✓ available. That includes [[Modding:Modder Guide/APIs/Events|registering event handlers]], [[Modding:Modder Guide/APIs/Config|reading configuration]], [[Modding:Modder Guide/APIs/Content|loading assets]], and [[Modding:Modder Guide/APIs/Integrations#Mod registry|fetching mod info]].
 +
|-
 +
| <tt>helper.ModRegistry.GetApi</tt>
 +
| ✖ Not available, since some mods aren't initialised yet.
 +
|-
 +
| Game fields
 +
| ✖ Not reliably available, since mods are loaded early in the process. That includes core fields like <tt>Game1.objectInformation</tt>.
 +
|}
    
==Dependencies==
 
==Dependencies==
translators
8,432

edits