Changes

Jump to navigation Jump to search
Line 99: Line 99:  
Notes:
 
Notes:
 
* You can't call <samp>GetApi</samp> until all mods are initialised and their <samp>Entry</samp> methods called. You can use the <samp>GameLoop.GameLaunched</samp> [[#Events|event]] if you need to access mod APIs early; this is guaranteed to happen after all mods are initialised.
 
* You can't call <samp>GetApi</samp> until all mods are initialised and their <samp>Entry</samp> methods called. You can use the <samp>GameLoop.GameLaunched</samp> [[#Events|event]] if you need to access mod APIs early; this is guaranteed to happen after all mods are initialised.
* You should always null-check APIs you consume. <samp>GetApi</samp> will return <samp>null</samp> if the API isn't available (''e.g.,'' because the mod isn't already installed or doesn't have one), or if an error occurs fetching the API.
+
* You should always null-check APIs you consume. <samp>GetApi</samp> will return <samp>null</samp> if the API isn't available (''e.g.,'' because the mod isn't already installed or doesn't have one). If <samp>GetAPi</smap> cannot map an API, it will throw an exception.
 
* Keep in mind that mods may change their API interfaces over time; it may be useful to check the version of the other mod before trying to map the interface.
 
* Keep in mind that mods may change their API interfaces over time; it may be useful to check the version of the other mod before trying to map the interface.
  
528

edits

Navigation menu