Fashion Sense API - Floogen/FashionSense GitHub Wiki
The API allows mod authors to set (override) the player's current appearance with any Fashion Sense appearances. You can also utilize the API to clear (remove) the player's current Fashion Sense appearance.
Note: The player will be alerted via SMAPI's console when a mod overrides their appearance, in order to avoid any confusion.
To utilize Fashion Sense's API, you will need to create a SMAPI mod. From there, copy Fashion Sense API's interface to your project.
You can find more detailed instructions on Stardew Valley's wiki.
Once you've connected to the API, you can simply call any of the methods found in the interface.
For example, setting the player's hat to the Animated Pumpkin Head hat found in example pack can be done like so:
var api = Helper.ModRegistry.GetApi<IApi>("PeacefulEnd.FashionSense");
var response = api.SetAppearance(Type.Hat, "ExampleAuthor.ExampleFashionSensePack", "Animated Pumpkin Head", this.ModManifest);
if (response.Key is true)
{
// Setting was successful!
}
The setters in the API all return a KeyValuePair<bool, string>
, the key being the status of the call (e.g. if it was successful) and the value representing any error or result messages.
If setting a Fashion Sense appearance that belongs to a missing pack (e.g. not installed), you will get a response from the API that the call failed due to an invalid appearance id.