Difference between revisions of "Modding:Content packs"

From Stardew Valley Wiki
Jump to navigation Jump to search
(+ folder name convention)
(→‎Create a content pack: tweak link text)
 
(25 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
←[[Modding:Index|Index]]
 
←[[Modding:Index|Index]]
  
A '''content pack''' is a collection of files for a specific SMAPI mod to read (essentially a sub-mod). Content packs can contain any files, but usually consist of JSON files and images.
+
A '''content pack''' is a collection of files loaded by a specific [[Modding:Content pack frameworks|content pack framework]] (essentially a sub-mod). Content packs can contain any files, but usually consist of JSON files and images.
  
==For players==
+
== For players ==
 
If you want to use a content pack, install it just like a SMAPI mod (see [[Modding:Player Guide/Getting Started|player guide]]). Make sure you install the mod it needs too.
 
If you want to use a content pack, install it just like a SMAPI mod (see [[Modding:Player Guide/Getting Started|player guide]]). Make sure you install the mod it needs too.
  
==For modders==
+
== For modders ==
===Create a content pack===
+
=== Create a content pack ===
 +
# Decide which [[Modding:Content pack frameworks|content pack framework]] you'll use (each framework defines the particular files you need).
 
# [[Modding:Player Guide/Getting Started#Getting started|Install SMAPI]].
 
# [[Modding:Player Guide/Getting Started#Getting started|Install SMAPI]].
# Open your game's <tt>Mods</tt> folder (located in [[Modding:Player Guide/Getting Started#Find your game folder|your game folder]]).
+
# Create the generic content pack format (identical for all frameworks):
# Add a subfolder with the name you want (see [[#Folder name|folder naming convention]]).
+
## Open your game's <samp>Mods</samp> folder (located in [[Modding:Player Guide/Getting Started#Find your game folder|your game folder]]).
# Inside the subfolder:
+
## Add a subfolder with the name you want (see [[#Folder name|folder naming convention]]).
#* Add a <tt>manifest.json</tt> file with the <tt>ContentPackFor</tt> field (see [[Modding:Modder Guide/APIs/Manifest|manifest format]]).
+
## In the subfolder, add a <samp>manifest.json</samp> file with the <samp>ContentPackFor</samp> field (see [[Modding:Modder Guide/APIs/Manifest|manifest examples and format]]).
#* Add the files needed by the mod that will read it. (See the instructions for the mod for which you're creating the content pack.)
+
# Add the files needed by the content pack framework (see its mod page for details).
 
# Launch the game, and make sure your new content pack appears under "Loaded X content packs" in the SMAPI console.
 
# Launch the game, and make sure your new content pack appears under "Loaded X content packs" in the SMAPI console.
  
 
===Release your content pack===
 
===Release your content pack===
 
# Add an [[Modding:Modder Guide/APIs/Manifest#Update checks|update key]] to your manifest (if you haven't already).
 
# Add an [[Modding:Modder Guide/APIs/Manifest#Update checks|update key]] to your manifest (if you haven't already).
# Update the <tt>Version</tt> field in the manifest. (Increase it for each release! SMAPI will use it for update and compatibility checks.)
+
# Update the <samp>Version</samp> field in the manifest. (Increase it for each release! SMAPI will use it for update and compatibility checks.)
# Create a <tt>.zip</tt> file containing the content pack's folder.
+
# Create a <samp>.zip</samp> file containing the content pack's folder.
 
# Upload that file to [http://www.nexusmods.com/stardewvalley Nexus Mods].
 
# Upload that file to [http://www.nexusmods.com/stardewvalley Nexus Mods].
  
Line 40: Line 41:
  
 
===Folder name===
 
===Folder name===
The folder name should use [https://en.wikipedia.org/wiki/Camel_case upper camel case] with a prefix showing which mod it's for. For example, a folder named <code>[CP] SampleName</code> is a content pack for Content Patcher.
+
The folder name should use [[wikipedia:Camel case|upper camel case]], with an acroynm prefix in square brackets showing which mod it's for. For example, a folder named <code>[CP] SampleName</code> is a content pack for Content Patcher.
  
Here are some common prefixes:
+
See [[Modding:Content pack frameworks]] for the common acronyms.
{| class="wikitable"
+
 
|-
+
===Folder structure===
! prefix
+
The folder should contain your <code>manifest.json</code>, the <code>content.json</code> (or the correct json for your framework), and an <code>assets</code> folder that contains any other files your mod uses.  This may include <samp>.png</samp> files, other <samp>.json</samp> files, and even or <samp>.tmx/.tbin</samp> files, among others. The assets folder may use further subfolders if you wish, though it is not required.
! for mod
 
|-
 
| <code>[ALL]</code>
 
| {{nexus mod|2270|Advanced Location Loader}}
 
|-
 
| <code>[CFR]</code>
 
| {{nexus mod|991|Custom Farming Redux}}
 
|-
 
| <code>[CP]</code>
 
| {{nexus mod|1915|Content Patcher}}
 
|-
 
| <code>[JA]</code>
 
| {{nexus mod|1720|Json Assets}}
 
|}
 
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 +
 +
[[pt:Modificações:Pacotes de conteúdo]]
 +
[[zh:模组:内容包]]

Latest revision as of 00:31, 11 January 2024

Index

A content pack is a collection of files loaded by a specific content pack framework (essentially a sub-mod). Content packs can contain any files, but usually consist of JSON files and images.

For players

If you want to use a content pack, install it just like a SMAPI mod (see player guide). Make sure you install the mod it needs too.

For modders

Create a content pack

  1. Decide which content pack framework you'll use (each framework defines the particular files you need).
  2. Install SMAPI.
  3. Create the generic content pack format (identical for all frameworks):
    1. Open your game's Mods folder (located in your game folder).
    2. Add a subfolder with the name you want (see folder naming convention).
    3. In the subfolder, add a manifest.json file with the ContentPackFor field (see manifest examples and format).
  4. Add the files needed by the content pack framework (see its mod page for details).
  5. Launch the game, and make sure your new content pack appears under "Loaded X content packs" in the SMAPI console.

Release your content pack

  1. Add an update key to your manifest (if you haven't already).
  2. Update the Version field in the manifest. (Increase it for each release! SMAPI will use it for update and compatibility checks.)
  3. Create a .zip file containing the content pack's folder.
  4. Upload that file to Nexus Mods.

In your mod description, providing clear install steps will help reduce support questions. Example BBCode:

[size=5]Install[/size]
[list=1]
[*][url=https://smapi.io]Install the latest version of SMAPI[/url].
[*][url=<url of required mod>]Install <name of required mod>[/url].
[*]Download this mod and unzip it into [font=Courier New]Stardew Valley/Mods[/font].
[*]Run the game using SMAPI.
[/list]

Consume a content pack

If you're writing a SMAPI mod which will read content packs, see Modding:Modder Guide/APIs/Content Packs.

Conventions

These are recommended practices, but they're not required.

Folder name

The folder name should use upper camel case, with an acroynm prefix in square brackets showing which mod it's for. For example, a folder named [CP] SampleName is a content pack for Content Patcher.

See Modding:Content pack frameworks for the common acronyms.

Folder structure

The folder should contain your manifest.json, the content.json (or the correct json for your framework), and an assets folder that contains any other files your mod uses. This may include .png files, other .json files, and even or .tmx/.tbin files, among others. The assets folder may use further subfolders if you wish, though it is not required.