Line 17: |
Line 17: |
| | | |
| ===Assets=== | | ===Assets=== |
− | An ''asset'' is essentially a file in the game's <tt>Content</tt> folder with a unique ''asset name''. The asset name never includes the <tt>Content</tt> path, language, or file extension (you can use tokens to target specific languages). For example: | + | An ''asset'' is essentially a file in the game's <samp>Content</samp> folder with a unique ''asset name''. The asset name never includes the <samp>Content</samp> path, language, or file extension (you can use tokens to target specific languages). For example: |
| | | |
| {| class="wikitable" | | {| class="wikitable" |
Line 24: |
Line 24: |
| ! asset name | | ! asset name |
| |- | | |- |
− | | <tt>Content/Portraits/Abigail.xnb</tt> | + | | <samp>Content/Portraits/Abigail.xnb</samp> |
− | | <tt>Portraits/Abigail</tt> | + | | <samp>Portraits/Abigail</samp> |
| |- | | |- |
− | | <tt>Content/Maps/spring_beach.xnb</tt><br /><tt>Content/Maps/spring_beach.es-ES.xnb</tt><br /><tt>Content/Maps/spring_beach.fr-FR.xnb</tt> | + | | <samp>Content/Maps/spring_beach.xnb</samp><br /><samp>Content/Maps/spring_beach.es-ES.xnb</samp><br /><samp>Content/Maps/spring_beach.fr-FR.xnb</samp> |
− | | <tt>Maps/spring_beach</tt> | + | | <samp>Maps/spring_beach</samp> |
| |} | | |} |
| | | |
− | An asset may contain multiple sprites or data entries. For example, here's what <tt>Portraits/Abigail</tt> contains if you unpack it: | + | An asset may contain multiple sprites or data entries. For example, here's what <samp>Portraits/Abigail</samp> contains if you unpack it: |
| | | |
| [[File:Modding - creating an XNB mod - example portraits.png]] | | [[File:Modding - creating an XNB mod - example portraits.png]] |
| | | |
− | So if you wanted to change Abigail's portraits, you would use Content Patcher to load or edit <tt>Portraits/Abigail</tt>. | + | So if you wanted to change Abigail's portraits, you would use Content Patcher to load or edit <samp>Portraits/Abigail</samp>. |
| | | |
| ===Load vs edits=== | | ===Load vs edits=== |
| There are two conceptual ways you can change an asset: | | There are two conceptual ways you can change an asset: |
| | | |
− | * ''Load'' the initial version of an asset. Each asset can only be loaded by one mod at the same time. This is mainly useful for total replacement mods (like a mod that completely changes an NPC's portraits), or to provide files that don't exist in the <tt>Content</tt> folder. | + | * ''Load'' the initial version of an asset. Each asset can only be loaded by one mod at the same time. This is mainly useful for total replacement mods (like a mod that completely changes an NPC's portraits), or to provide files that don't exist in the <samp>Content</samp> folder. |
| * ''Edit'' an asset after it's loaded. Any number of edits can be applied to the same asset. | | * ''Edit'' an asset after it's loaded. Any number of edits can be applied to the same asset. |
| | | |
Line 54: |
Line 54: |
| </pre> | | </pre> |
| | | |
− | This is divided into four main action types (<tt>Load</tt>, <tt>EditData</tt>, <tt>EditImage</tt>, <tt>EditMap</tt>), which are explained in more detail in the Content Patcher readme (see below). | + | This is divided into four main action types (<samp>Load</samp>, <samp>EditData</samp>, <samp>EditImage</samp>, <samp>EditMap</samp>), which are explained in more detail in the Content Patcher readme (see below). |
| | | |
| ==Get started== | | ==Get started== |
| ===Intro to JSON=== | | ===Intro to JSON=== |
− | You'll notice a lot of files with <tt>.json</tt> at the end of the name when creating mods for Stardew Valley. That means they're formatted as JSON, which is just a way of writing text that's readable to code. If you haven't used JSON before, reading ''[https://towardsdatascience.com/an-introduction-to-json-c9acb464f43e An Introduction to JSON]'' first will be very helpful to understand what the files are doing. | + | You'll notice a lot of files with <samp>.json</samp> at the end of the name when creating mods for Stardew Valley. That means they're formatted as JSON, which is just a way of writing text that's readable to code. If you haven't used JSON before, reading ''[https://towardsdatascience.com/an-introduction-to-json-c9acb464f43e An Introduction to JSON]'' first will be very helpful to understand what the files are doing. |
| | | |
| ===Create example mod=== | | ===Create example mod=== |
Line 64: |
Line 64: |
| <ol> | | <ol> |
| <li>Install [https://smapi.io/ SMAPI] and {{nexus mod|1915|Content Patcher}}.</li> | | <li>Install [https://smapi.io/ SMAPI] and {{nexus mod|1915|Content Patcher}}.</li> |
− | <li>Unpack the game's <tt>Content</tt> folder so you can see what each asset contains (see [[Modding:Editing XNB files#Unpack game files]]).</li> | + | <li>Unpack the game's <samp>Content</samp> folder so you can see what each asset contains (see [[Modding:Editing XNB files#Unpack game files]]).</li> |
| <li>[[Modding:Content packs#Create a content pack|Create a SMAPI content pack per step 3 of the general Create a Content Pack page]].</li> | | <li>[[Modding:Content packs#Create a content pack|Create a SMAPI content pack per step 3 of the general Create a Content Pack page]].</li> |
− | <li>Create a <tt>content.json</tt> file in the same folder with this content: | + | <li>Create a <samp>content.json</samp> file in the same folder with this content: |
| {{#tag:syntaxhighlight| | | {{#tag:syntaxhighlight| |
| { | | { |
Line 80: |
Line 80: |
| | | |
| ===Content format=== | | ===Content format=== |
− | The <tt>content.json</tt> file you created above is what tells Content Patcher what to change. This has two main fields: | + | The <samp>content.json</samp> file you created above is what tells Content Patcher what to change. This has two main fields: |
| | | |
− | * <tt>Format</tt>: the format version. You should always use the latest version (currently 1.23.0) to enable the latest features and avoid obsolete behavior. | + | * <samp>Format</samp>: the format version. You should always use the latest version (currently 1.23.0) to enable the latest features and avoid obsolete behavior. |
− | * <tt>Changes</tt>: the changes you want to make. Each entry is called a ''patch'', and describes a specific action to perform: replace this file, copy this image into the file, etc. You can list any number of patches. | + | * <samp>Changes</samp>: the changes you want to make. Each entry is called a ''patch'', and describes a specific action to perform: replace this file, copy this image into the file, etc. You can list any number of patches. |
| | | |
− | You can list any number of patches in the <tt>Changes</tt> field, each surrounded by <code>{</code> and <code>}</code>. See the next section for more info, but here's a quick example: | + | You can list any number of patches in the <samp>Changes</samp> field, each surrounded by <code>{</code> and <code>}</code>. See the next section for more info, but here's a quick example: |
| {{#tag:syntaxhighlight| | | {{#tag:syntaxhighlight| |
| { | | { |
Line 104: |
Line 104: |
| }|lang=javascript}} | | }|lang=javascript}} |
| | | |
− | (There are other fields like <tt>ConfigSchema</tt> and <tt>DynamicTokens</tt> for more advanced usage; these are covered in the full readme.) | + | (There are other fields like <samp>ConfigSchema</samp> and <samp>DynamicTokens</samp> for more advanced usage; these are covered in the full readme.) |
| | | |
| ==Next steps== | | ==Next steps== |