← [README](README.md) This document helps mod authors create a content pack for Content Patcher. **See the [main README](README.md) for other info**. **🌐 In other languages: [zh (中文)](zh/author-guide.md)**. ## Contents * [Introduction](#introduction) * [What is Content Patcher?](#what-is-content-patcher) * [What does a content pack look like?](#what-does-a-content-pack-look-like) * [What is an asset?](#what-is-an-asset) * [Get started](#get-started) * [Create the content pack](#create-the-content-pack) * [Format version](#format-version) * [Changes](#changes) * [Features](#features) * [Actions](#actions) * [Custom locations](#custom-locations) * [Tokens & conditions](#tokens) * [Player config](#player-config) * [Translations](#translations) * [Text operations](#text-operations) * [Trigger actions](#trigger-actions) * [Troubleshoot](#troubleshoot) * [FAQs](#faqs) * [How often are patch changes applied?](#update-rate) * [Are Content Patcher updates backwards-compatible?](#are-content-patcher-updates-backwards-compatible) * [How do I change assets in another language?](#how-do-i-change-assets-in-another-language) * [How do multiple patches interact?](#how-do-multiple-patches-interact) * [Known limitations](#known-limitations) * [See also](#see-also) ## Introduction ### What is Content Patcher? Content Patcher lets you change the game content using only JSON files. JSON is just a text format, so no programming experience is needed. You can make a wide range of changes to the game: * change images, dialogue, maps, etc; * add custom items, fruit trees, locations, etc; * change shop inventory; * and much more. You can also make very dynamic changes to the game. For example, raise the price of coffee on winter weekend evenings when it's snowing unless the player married Abigail. The [modding documentation on the wiki](https://stardewvalleywiki.com/Modding:Index#Advanced_topics) is often written for Content Patcher pack authors, so you can find many specific examples there. ### What does a content pack look like? A content pack is just a folder with two text files in it: `manifest.json` (which has info like your mod name) and `content.json` (which tells Content Patcher what you want to change). Your folder might also have images or other files, which are usually in an `assets` subfolder by convention: ``` 📁 Mods/ 📁 [CP] YourModName/ 🗎 content.json 🗎 manifest.json 📁 assets/ 🗎 example.png ``` For example, here's a `content.json` which replaces Abigail's portraits with your own image: ```js { "Format": "2.9.0", "Changes": [ { "Action": "Load", "Target": "Portraits/Abigail", "FromFile": "assets/abigail.png" } ] } ``` You can do _much_ more with Content Patcher using features like actions, tokens, conditions, and more. This guide goes into more detail below. ### What is an asset? An _asset_ is an image, data model, or map which the game loads from its `Content` folder (or from mods). These are what Content Patcher lets you change. The asset name never includes "Content", the [language code](#how-do-i-change-assets-in-another-language), or the file extension. For example, both `Content/Maps/spring_beach.xnb` and `Content/Maps/spring_beach.fr-FR.xnb` are the same `Maps/spring_beach` asset. You can [unpack the game's content files](https://stardewvalleywiki.com/Modding:Editing_XNB_files#unpacking) to see what they contain. Here's what `Portraits/Abigail` contains:  So if you wanted to change Abigail's portraits, you would use Content Patcher to load or edit `Portraits/Abigail` and change that image like in the previous example code. ## Get started ### Create the content pack 1. Install [SMAPI](https://www.nexusmods.com/stardewvalley/mods/2400) and [Content Patcher](https://www.nexusmods.com/stardewvalley/mods/1915). 2. Create an empty folder in your `Mods` folder, and name it `[CP] YourModName`. Replace `YourModName` with a unique name for your mod. 3. Create a `manifest.json` file with this content: ```js { "Name": "Your Mod Name", "Author": "Your Name", "Version": "1.0.0", "Description": "One or two sentences about the mod.", "UniqueID": "YourName.YourModName", "UpdateKeys": [], // when you release the mod, see https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Update_checks "ContentPackFor": { "UniqueID": "Pathoschild.ContentPatcher" } } ``` 4. Change the `Name`, `Author`, `Description`, and `UniqueID` values to describe your mod. (Don't change the `UniqueID` under `ContentPackFor`!) 5. Create a `content.json` file with this content: ```js { "Format": "2.9.0", "Changes": [ // your changes will go here ] } ``` That's it! You now have a working Content Patcher pack, though it doesn't do anything yet. ### Format version That `Format` field is the version of Content Patcher for which you designed the content pack. This is used to keep your content pack compatible with future versions. You should always use the latest format version (currently `2.9.0`) to enable the latest features, avoid obsolete behavior, and reduce startup time. ### Changes The `Changes` field describes what you want to change in the game. Each entry in the list is called a **patch**, and describes a specific action to perform: edit this image, change this dialogue, etc. You can list any number of patches, and you can apply multiple patches to the same file (they'll be applied one after another in the order listed). ## Features **Note:** these are ordered by how often content packs use them. You don't need to know or use all of these features. ### Actions Every patch has an `Action` field, which is the type of change you want to make. See the documentation page for each action (linked below) for more info on each one.
| action | overview |
|---|---|
Load |
`Load` replaces an entire asset with a version you provide. For example, if you have an `assets/abigail.png` image with custom portraits for Abigail, this would change her portraits in-game: ```js { "Format": "2.9.0", "Changes": [ { "Action": "Load", "Target": "Portraits/Abigail", "FromFile": "assets/abigail.png" } ] } ``` This isn't recommended if you can use one of the `Edit*` actions instead. See the [`Action: Load` documentation](author-guide/action-load.md) for more info. |
EditData |
`EditData` changes the data read from a data asset. This supports simple lookup assets like `Data/Achievements`, or full data model assets like `Data/Objects`. Any number of content packs can edit the same asset. This lets you... * add, edit, or delete entries; * reorder entries in a list; * or edit individual fields within an entry. For example, this doubles the price of moss soup (see [object fields](https://stardewvalleywiki.com/Modding:Object_data)): ```js { "Format": "2.9.0", "Changes": [ { "Action": "EditData", "Target": "Data/Objects", "Fields": { "MossSoup": { "Price": 80 } } } ] } ``` You can do much more using `EditData`, including add completely custom items, fruit trees, etc. See the [`Action: EditData` documentation](author-guide/action-editdata.md) for more info. |
EditImage |
`EditImage` edits one of the game's image assets. Any number of content packs can edit the same image. This lets you... * edit or replace any portion of the image; * overlay a new image onto the existing one with transparency support; * or extend the image size (e.g. to add more sprites to a spritesheet). For example, if your content pack has an `assets/tuna.png` image with a custom [tuna](https://stardewvalleywiki.com/Tuna) sprite, this would replace tuna sprites in-game: ```js { "Format": "2.9.0", "Changes": [ { "Action": "EditImage", "Target": "Maps/springobjects", "FromFile": "assets/fish-object.png", "ToArea": { "X": 160, "Y": 80, "Width": 16, "Height": 16 } } ] } ``` See the [`Action: EditImage` documentation](author-guide/action-editimage.md) for more info. |
EditMap |
`EditMap` changes part of an in-game map. Any number of content packs can edit the same map. This lets you... * change map properties, tile properties, and tiles; * paste a local map into part of the target map (with various merge options); * add custom tilesheets; * or resize the map (e.g. to add more content to an existing game location). For example, this replaces the town square with a custom version in your content folder: ```js { "Format": "2.9.0", "Changes": [ { "Action": "EditMap", "Target": "Maps/Town", "FromFile": "assets/town.tmx", "ToArea": { "X": 22, "Y": 61, "Width": 16, "Height": 13 } } ] } ``` See the [`Action: EditMap` documentation](author-guide/action-editmap.md) for more info. |
Include |
`Include` adds patches from another file. This is just a way to organize your content pack into multiple files, instead of having everything in one `content.json`. The included patches work exactly as if they were directly in `content.json`. For example, you can combine this with [tokens and condition](#tokens) to load a dynamic file: ```js { "Format": "2.9.0", "Changes": [ { "Action": "Include", "FromFile": "assets/john_{{season}}.json" } ] } ``` See the [`Action: Include` documentation](author-guide/action-include.md) for more info. |