Changes

Jump to navigation Jump to search
→‎Introduction: Fix broken links, minor text edits to remove "migration guide feel" of tenses, etc.
Line 6: Line 6:     
===Overview===
 
===Overview===
Stardew Valley 1.6 makes three major changes to how items work in the game:
+
As of Stardew Valley 1.6, there are a few important features of Items in the game.
   −
# Each item now has a string ID (<samp>ItemId</samp>) and a globally unique string ID (<samp>QualifiedItemId</samp>). The <samp>QualifiedItemId</samp> is auto-generated by prefixing the <samp>ItemId</samp> with the item type identifier.<p>For legacy reasons, the <samp>ItemId</samp> for vanilla items may not be globally unique. For example, Pufferfish (object 128) and Mushroom Box (bigcraftable 128) both have <samp>ItemId: 128</samp>. They can be distinguished by their <samp>QualifiedItemId</samp>, which are <samp>(O)128</samp> and <samp>(BC)128</samp> respectively.
+
# Each item as a string ID (<samp>ItemId</samp>) and a globally-unique string ID (<samp>QualifiedItemId</samp>). The <samp>QualifiedItemId</samp> is auto-generated by prefixing the <samp>ItemId</samp> with the item type identifier.<p>For legacy reasons, the <samp>ItemId</samp> for vanilla items may not be globally unique. For example, Pufferfish (object 128) and Mushroom Box (bigcraftable 128) both have <samp>ItemId: 128</samp>. They can be distinguished by their <samp>QualifiedItemId</samp>, which are <samp>(O)128</samp> and <samp>(BC)128</samp> respectively.
# Each item type now has an ''item data definition'' in the game code which tells the game how to handle it. [[#For C# mods|C# mods can add or edit definitions]]. Each definition has a unique prefix which is used in the qualified item IDs. The vanilla types are bigcraftables (<samp>(BC)</samp>), boots (<samp>(B)</samp>), farmhouse flooring (<samp>(FL)</samp>), furniture (<samp>(F)</samp>), hats (<samp>(H)</samp>), objects (<samp>(O)</samp>), pants (<samp>(P)</samp>), shirts (<samp>(S)</samp>), tools (<samp>(T)</samp>), wallpaper (<samp>(WP)</samp>), and weapons (<samp>(W)</samp>).</li>
+
# Each item type has an ''item data definition'' in the game code which tells the game how to handle it. [[#For C# mods|C# mods can add or edit definitions]]. Each definition has a unique prefix which is used in the qualified item IDs. The vanilla types are bigcraftables (<samp>(BC)</samp>), boots (<samp>(B)</samp>), farmhouse flooring (<samp>(FL)</samp>), furniture (<samp>(F)</samp>), hats (<samp>(H)</samp>), objects (<samp>(O)</samp>), pants (<samp>(P)</samp>), shirts (<samp>(S)</samp>), tools (<samp>(T)</samp>), wallpaper (<samp>(WP)</samp>), and weapons (<samp>(W)</samp>).</li>
 
# Custom items can now provide their own item texture, specified in a new field in the item data assets (see below). The item's <samp>ParentSheetIndex</samp> field is the index within that texture.
 
# Custom items can now provide their own item texture, specified in a new field in the item data assets (see below). The item's <samp>ParentSheetIndex</samp> field is the index within that texture.
   Line 59: Line 59:  
* Output: set field 2 to the unqualified item ID, and field 3 to one of <samp>true</samp> (bigcraftable) or <samp>false</samp> (object).
 
* Output: set field 2 to the unqualified item ID, and field 3 to one of <samp>true</samp> (bigcraftable) or <samp>false</samp> (object).
 
|-
 
|-
| [[#Custom fruit trees|<samp>Data/fruitTrees</samp>]]
+
| [[Modding:Fruit_trees|<samp>Data/FruitTrees</samp>]]
 
| &#32;
 
| &#32;
 
* Fruit: both supported.
 
* Fruit: both supported.
Line 77: Line 77:  
! data asset
 
! data asset
 
|-
 
|-
| [[Modding:Items|big craftables]]
+
| [[Modding:Items#Big_craftables|Big craftables]]
 
| <samp>(BC)</samp>
 
| <samp>(BC)</samp>
 
| <samp>Data/BigCraftables</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>TileSheets/Craftables</samp>.</small>
 
| <samp>Data/BigCraftables</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>TileSheets/Craftables</samp>.</small>
 
|-
 
|-
| boots
+
| [[Modding:Items#Boots|Boots]]
 
| <samp>(B)</samp>
 
| <samp>(B)</samp>
 
| <samp>Data/Boots</samp><br /><small>Each item can set a custom texture name in fields 9 (item) and 7 (shoe color), and sprite index in fields 8 (item) and 5 (shoe color). The default textures are <samp>Maps/springobjects</samp> (item) and <samp>Characters/Farmer/shoeColors</samp> (shoe color).</small>
 
| <samp>Data/Boots</samp><br /><small>Each item can set a custom texture name in fields 9 (item) and 7 (shoe color), and sprite index in fields 8 (item) and 5 (shoe color). The default textures are <samp>Maps/springobjects</samp> (item) and <samp>Characters/Farmer/shoeColors</samp> (shoe color).</small>
 
|-
 
|-
| [[Modding:Crop data|crops]]
+
| [[Modding:Crop data|Crops]]
 
| <small>''not technically an item type''</small>
 
| <small>''not technically an item type''</small>
 
| <samp>Data/Crops</samp><br /><small>Each crop can set a custom texture name and sprite index. The default texture is <samp>TileSheets/crops</samp>.</small>
 
| <samp>Data/Crops</samp><br /><small>Each crop can set a custom texture name and sprite index. The default texture is <samp>TileSheets/crops</samp>.</small>
 
|-
 
|-
| [[Modding:Fish data|fish (in fish tanks)]]
+
| [[Modding:Fish data|Fish (in fish tanks)]]
 
| <small>''not technically an item type''</small>
 
| <small>''not technically an item type''</small>
 
| <samp>Data/AquariumFish</samp><br /><small>Each fish can set a custom aquarium texture name in field 6, and sprite index in field 0. The default texture is <samp>LooseSprites/AquariumFish</samp>.</small>
 
| <samp>Data/AquariumFish</samp><br /><small>Each fish can set a custom aquarium texture name in field 6, and sprite index in field 0. The default texture is <samp>LooseSprites/AquariumFish</samp>.</small>
 
|-
 
|-
| [[Modding:Items|furniture]]
+
| [[Modding:Items#Furniture|Furniture]]
 
| <samp>(F)</samp>
 
| <samp>(F)</samp>
 
| <samp>Data/Furniture</samp><br /><small>Each item can set a custom texture name in field 9, and sprite index in field 8. The default texture is <samp>TileSheets/furniture</samp>.</small>
 
| <samp>Data/Furniture</samp><br /><small>Each item can set a custom texture name in field 9, and sprite index in field 8. The default texture is <samp>TileSheets/furniture</samp>.</small>
 
|-
 
|-
| fruit trees
+
| [[Modding:Fruit_trees|Fruit Trees]]
 
| <small>''not technically an item type''</small>
 
| <small>''not technically an item type''</small>
 
| <samp>Data/FruitTrees</samp><br /><small>Each fruit tree can set a custom texture name and sprite index. The default texture is <samp>TileSheets/fruitTrees</samp>.</small>
 
| <samp>Data/FruitTrees</samp><br /><small>Each fruit tree can set a custom texture name and sprite index. The default texture is <samp>TileSheets/fruitTrees</samp>.</small>
 
|-
 
|-
| [[Modding:Items|hats]]
+
| [[Modding:Items#Hats|Hats]]
 
| <samp>(H)</samp>
 
| <samp>(H)</samp>
 
| <samp>Data/Hats</samp><br /><small>Each item can set a custom texture name in field 7, and sprite index in field 6. The default texture is <samp>Characters/Farmer/hats</samp>.</small>
 
| <samp>Data/Hats</samp><br /><small>Each item can set a custom texture name in field 7, and sprite index in field 6. The default texture is <samp>Characters/Farmer/hats</samp>.</small>
 
|-
 
|-
| [[Modding:Items|objects]]
+
| [[Modding:Items#Objects|Objects]]
 
| <samp>(O)</samp>
 
| <samp>(O)</samp>
 
| <samp>Data/Objects</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Maps/springobjects</samp>.</small>
 
| <samp>Data/Objects</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Maps/springobjects</samp>.</small>
 
|-
 
|-
| [[#Custom pants|pants]]
+
| [[Modding:Items#Pants|Pants]]
 
| <samp>(P)</samp>
 
| <samp>(P)</samp>
 
| <samp>Data/pantsData</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Characters/Farmer/pants</samp>.</small>
 
| <samp>Data/pantsData</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Characters/Farmer/pants</samp>.</small>
 
|-
 
|-
| [[#Custom shirts|shirts]]
+
| [[Modding:Items#Shirts|Shirts]]
 
| <samp>(S)</samp>
 
| <samp>(S)</samp>
 
| <samp>Data/shirtData</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Characters/Farmer/shirts</samp>.</small>
 
| <samp>Data/shirtData</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The default texture is <samp>Characters/Farmer/shirts</samp>.</small>
Line 131: Line 131:  
</pre>
 
</pre>
 
|-
 
|-
| [[#Custom tools|tools]]
+
| [[#Custom tools|Tools]]
 
| <samp>(T)</samp>
 
| <samp>(T)</samp>
 
| <samp>Data/Tools</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The vanilla tools use the <samp>TileSheets/Tools</samp> texture.</small>
 
| <samp>Data/Tools</samp><br /><small>Each item can set a custom texture name in the <samp>Texture</samp> field, and sprite index in the <samp>SpriteIndex</samp> field. The vanilla tools use the <samp>TileSheets/Tools</samp> texture.</small>
 
|-
 
|-
| Wallpaper & floorpaper
+
| Wallpaper & flooring
 
| <samp>(WP)</samp> and <samp>(FL)</samp>
 
| <samp>(WP)</samp> and <samp>(FL)</samp>
 
| <samp>Data/AdditionalWallpaperFlooring</samp><br /><small>See [[Modding:Migrate to Stardew Valley 1.5.5#In the furniture catalogue|format docs]].</small>
 
| <samp>Data/AdditionalWallpaperFlooring</samp><br /><small>See [[Modding:Migrate to Stardew Valley 1.5.5#In the furniture catalogue|format docs]].</small>
 
|-
 
|-
| [[Modding:Items|weapons]]
+
| [[Modding:Items#Weapons|Weapons]]
 
| <samp>(W)</samp>
 
| <samp>(W)</samp>
| <samp>Data/Weapons</samp><br /><small>[[#Custom melee weapons|Completely overhauled]] into a data model.</small>
+
| <samp>Data/Weapons</samp><br />
 
|}
 
|}
   Line 151: Line 151:     
Each item has a <samp>ParentSheetIndex</samp> field which is its position in the item type's spritesheet, starting at 0 in the top-left and incrementing by one as you move across and then down. For example, hat #0 is the first sprite in <samp>Characters/Farmer/hats</samp>. The <samp>ParentSheetIndex</samp> is also used to identify the item itself; since spritesheet indexes aren't unique (''e.g.,'' there's both a hat #10 and object #10), code needs to check the type too like <code>item is Weapon weapon && weapon.ParentSheetIndex == 4</code>.
 
Each item has a <samp>ParentSheetIndex</samp> field which is its position in the item type's spritesheet, starting at 0 in the top-left and incrementing by one as you move across and then down. For example, hat #0 is the first sprite in <samp>Characters/Farmer/hats</samp>. The <samp>ParentSheetIndex</samp> is also used to identify the item itself; since spritesheet indexes aren't unique (''e.g.,'' there's both a hat #10 and object #10), code needs to check the type too like <code>item is Weapon weapon && weapon.ParentSheetIndex == 4</code>.
  −
See the sections below for details on each item type.
      
===Get a list of items===
 
===Get a list of items===
Line 224: Line 222:  
}</nowiki>|lang=javascript}}
 
}</nowiki>|lang=javascript}}
   −
Most item data assets work just like <samp>Data/Objects</samp>. See also specific info for [[#Custom fruit trees|custom fruit trees]], [[#Custom tools|custom tools]], and [[#Custom melee weapon data|melee weapons]].
+
Most item data assets work just like <samp>Data/Objects</samp>. See also specific info for [[Modding:Fruit_trees|custom fruit trees]], [[Modding:Items#Tools|custom tools]], and [[Modding:Items#Weapons|melee weapons]].
 
      
===Error items===
 
===Error items===
In-game items with no underlying data (e.g. because you removed the mod which adds them) would previously cause issues like invisible items, errors, and crashes. This was partly mitigated by the bundled Error Handler mod.
+
Prior to 1.6, in-game items with no underlying data (e.g. because you removed the mod which adds them) would previously cause issues like invisible items, errors, and crashes. This was partly mitigated by the bundled Error Handler mod.
   −
Stardew Valley 1.6 adds comprehensive handling for such items. They'll be shown with a <samp>🛇</samp> sprite in inventory UIs and in-game, the name Error Item, and a description which indicates the missing item ID for troubleshooting.
+
Stardew Valley 1.6 added comprehensive handling for such items. They'll be shown with a <samp>🛇</samp> sprite in inventory UIs and in-game, the name Error Item, and a description which indicates the missing item ID for troubleshooting.
    
===For C# mods===
 
===For C# mods===
Line 264: Line 261:     
<dt>Construct items</dt>
 
<dt>Construct items</dt>
<dd>Creating items works just like before, except that you now specify the item's <samp>ItemId</samp> (''not'' <samp>QualifiedItemId</samp>) instead of its <samp>ParentSheetIndex</samp>. For example:
+
<dd>When constructing items, specify the item's <samp>ItemId</samp> (''not'' <samp>QualifiedItemId</samp>). For example:
    
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
Line 271: Line 268:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
You can use a new utility method to construct items from their <samp>QualifiedItemId</samp>:
+
You can use a utility method to construct items from their <samp>QualifiedItemId</samp>:
    
<syntaxhighlight lang="c#">
 
<syntaxhighlight lang="c#">
Line 284: Line 281:     
<dt>New <samp>Is*</samp> methods</dt>
 
<dt>New <samp>Is*</samp> methods</dt>
<dd>1.6 adds some <samp>StardewValley.Object</samp> methods to handle custom items in a generic way (and to let mods patch the logic):
+
<dd>1.6 added some <samp>StardewValley.Object</samp> methods to handle custom items in a generic way (and to let mods patch the logic):
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 324: Line 321:  
<dt>Work with item metadata</dt>
 
<dt>Work with item metadata</dt>
 
<dd>
 
<dd>
1.6 adds an <samp>ItemRegistry</samp> API for working with the new item system. Some of the provided methods are:
+
1.6 added an <samp>ItemRegistry</samp> API for working with the new item system. Some of the provided methods are:
    
{| class="wikitable"
 
{| class="wikitable"
138

edits

Navigation menu