Creating a Hat Content Pack - Floogen/FashionSense GitHub Wiki

Requires FS v2.2+

A content pack for Fashion Sense (FS) allows mod authors to create hats with the following benefits:

  • Can be larger than 16x32 pixels
  • Can be animated
  • Can override the player's hat color

Fashion Sense content packs are compatible with other FS packs, meaning you can have as many Fashion Sense hats as you'd like!

TL;DR Edition

  1. Create a parent folder with the content pack's name.

  2. Create and fill in manifest.json as a content pack.

  3. Create a Hats folder, add it under the content pack's main folder.

  4. Create a sub-folder under Hats with the name of the hat

    a. The name of the folder(s) under Hats do not matter.

  5. Create a hat.json under the created sub-folder, using the required fields found here.

  6. Create a hat.png under the same sub-folder.

    a. The image size doesn't matter, so long as it is under 16384x16384 pixels (though smaller files are preferred to reduce memory usage).


Structure

A Fashion Sense content pack consists of the following structure:

[FS] Example Pack
├── manifest.json
│
└── Hats
    ├── AnimatedPumpkinHead
    │   ├── hat.json
    │   └── hat.png
    │
    ├── ColorableMouseEars
    │   ├── hat.json
    │   └── hat.png
    │
    └── PrismaticDinoHead
        ├── hat.json
        └── hat.png

If this is your first time creating a content pack, it may be useful to read the Stardew Valley Wiki for creating a content pack.  

First Steps

The first step to making your content pack is to create a top level folder with the name of your content pack. For example: [FS] Example Pack. After that, you'll want to create the manifest.json file under that folder. Detailed instructions can be found on the Stardew Valley Wiki. Additionally, you can check out the example manifest.json as a reference. For example:

[FS] Example Pack
└──  manifest.json



It is important to note that the manifest.json file must contain the following for it to be a content pack by Fashion Sense:

"ContentPackFor": {
    "UniqueID": "PeacefulEnd.FashionSense",
    "MinimumVersion": "USE.LATEST.VERSION"
}

Note: Replace "MinimumVersion": "USE.LATEST.VERSION" with the latest version number of Fashion Sense found here.

 

Creating Hats

The folder structure

You will first need to create a Hats folder underneath your main content pack folder.

After creating the Hats folder you'll want to create a sub-folder for every hat you want to add, like so:

.
└── Hats
    ├── AnimatedPumpkinHead
    │
    ├── ColorableMouseEars
    │
    └── PrismaticDinoHead

You can also have sub-folders under the Hats folder for organizing, like so:

.
└── Hats
    ├── Animated or Colorable
    │   ├── AnimatedPumpkinHead
    │   └── ColorableMouseEars
    │
    └── Prismatic
        └── PrismaticDinoHead

 

Adding the hat

To add a hat to your content pack, the framework requires a hat.json under each sub-folder of Hats.

For example:

.
└── Hats
    ├── AnimatedPumpkinHead
    │   ├── hat.json
    │   └── hat.png
    │
    ├── ColorableMouseEars
    │   ├── hat.json
    │   └── hat.png
    │
    └── PrismaticDinoHead
        ├── hat.json
        └── hat.png

The file hat.json determines how the hat is to be applied and allows the usage of certain conditions for animation.

An overview of the required properties for hat.json:

Property Description Default
Name Required Name of the hat, which can contain spaces. N/A
Format Recommended The format version to use, which should be set to Fashion Sense's current version. "1.0.0"
BackHat Optional 1 Specifies how the hat will look while the player is facing backwards.
See this page for more details.
null
RightHat Optional 1 Specifies how the hat will look while the player is facing right.
See this page for more details.
null
FrontHat Optional 1 Specifies how the hat will look while the player is facing forward.
See this page for more details.
null
LeftHat Optional 1 Specifies how the hat will look while the player is facing left.
See this page for more details.
null
  1. At least one HatModel(FrontHat, BackHat, etc.) must be given for the hat to be valid.

    a. Note that HatModel have their own required properties, as can be seen here.

Basic JSON example

This is a simple hat.json, which adds a static (non-animated) hat that only applies while the player is facing forward.

{
  "Name": "Colorable Mouse Ears",
  "FrontHat": {
    "ColorMasks": [
      [ 191, 183, 181 ]
    ],
    "StartingPosition": {
      "X": 0,
      "Y": 0
    },
    "HeadPosition": {
      "X": -2,
      "Y": 0
    },
    "HatSize": {
      "Width": 16,
      "Length": 16
    }
  }
}

The StartingPosition property is used to determine where the starting point is (top-left most pixel for the HatModel).

The HeadPosition property is used to tell the framework where the player's head would be in relation to the hat. See the Short Hat With Fleas for another example.

Note: It is important to know that each HatModel added (FrontHat, BackHat, etc.) must have a StartingPosition, HeadPosition and HatSize, as the framework uses those properties to display the hat.

Basic hat example

The corresponding hat.png

The layout requirements for hat.png is fairly relaxed, as the framework utilizes StartingPosition, HeadPosition and HatSize to determine where the hat sprites are located.

See the example pack for references on how to create your hats.


Animated JSON example

This is an animated hat.json, which adds a hat with an idle animation and only applies while the player is facing forward.

{
  "Name": "Animated Pumpkin Head",
  "FrontHat": {
    "HideHair": true,
    "DisableGrayscale": true,
    "StartingPosition": {
      "X": 0,
      "Y": 0
    },
    "HeadPosition": {
      "X": -2,
      "Y": -2
    },
    "HatSize": {
      "Width": 16,
      "Length": 16
    },
    "UniformAnimation": [
      {
        "Frame": 0,
        "Duration": 200
      },
      {
        "Frame": 1,
        "Duration": 200
      },
      {
        "Frame": 0,
        "Duration": 167
      },
      {
        "Frame": 2,
        "Duration": 200
      },
      {
        "Frame": 0,
        "Duration": 2000
      },
      {
        "Frame": 3,
        "Duration": 167
      },
      {
        "Frame": 4,
        "Duration": 167
      },
      {
        "Frame": 0,
        "Duration": 2000
      }
    ]
  }
}

You can see IdleAnimation was specified with 4 frames. As the name implies, IdleAnimation only play while the player is not moving.

To play an animation only while the player is moving, you would instead utilize MovementAnimation. For more details see the animations page.

Conditions can also be used to determine which frames are played. See the conditions page for more details.

Animated hat example

The corresponding hat.png

The layout requirements for animated hat.png is fairly relaxed, as it only requires the following condition(s):

  • For HatModel with animation, each frame of the hat should be placed next to each other horizontally (as seen in the example above).

See the example pack for references on how to create your hats.

Next Step

If you're looking for examples, see the examples page.

⚠️ **GitHub.com Fallback** ⚠️