Jump to content

Modding:Items: Difference between revisions

From Stardew Valley Wiki
imported>Pathoschild
→Item types: add trinket type, update unqualified item ID priority list
imported>Malevolent-bagel
mNo edit summary
 
(8 intermediate revisions by 5 users not shown)
Line 7: Line 7:
Every item is identified in the game data using a unique item ID. This has two forms:
Every item is identified in the game data using a unique item ID. This has two forms:


* The ''unqualified item ID'' (<code>item.ItemId</code>) is a [[#Unique string ID|unique string ID]] for the item, like <samp>128</samp> (vanilla item) or <samp>Example.ModId_Watermelon</samp> (custom item). For legacy reasons, the unqualified ID for vanilla items may not be globally unique; for example, Pufferfish (object 128) and Mushroom Box (bigcraftable 128) both have item ID <samp>128</samp>.
* The ''unqualified item ID'' (<code>item.ItemId</code>) is a [[Modding:Common data field types#Unique string ID|unique string ID]] for the item, like <samp>128</samp> (vanilla item) or <samp>Example.ModId_Watermelon</samp> (custom item). For legacy reasons, the unqualified ID for vanilla items may not be globally unique; for example, Pufferfish (object 128) and Mushroom Box (bigcraftable 128) both have item ID <samp>128</samp>.
* The ''qualified item ID'' (<code>item.QualifiedItemId</code>) is a globally unique identifier which combines the item's [[#Item types|type ID]] and unqualified item ID, like <samp>(O)128</samp> for [[Modding:Objects|object]] ID 128.
* The ''qualified item ID'' (<code>item.QualifiedItemId</code>) is a globally unique identifier which combines the item's [[#Item types|type ID]] and unqualified item ID, like <samp>(O)128</samp> for [[Modding:Objects|object]] ID 128.


Line 103: Line 103:
For example, this content pack adds a new Pufferchick item with a custom image, custom gift tastes, and a custom crop that produces it. Note that item references in other data assets like <samp>Data/Crops</samp> and <samp>Data/NPCGiftTastes</samp> use the item ID.
For example, this content pack adds a new Pufferchick item with a custom image, custom gift tastes, and a custom crop that produces it. Note that item references in other data assets like <samp>Data/Crops</samp> and <samp>Data/NPCGiftTastes</samp> use the item ID.


{{#tag:syntaxhighlight|<nowiki>
{{Content Patcher example|<nowiki>
{
    "Format": "</nowiki>{{Content Patcher version}}<nowiki>",
     "Changes": [
     "Changes": [
         // add item
         // add item
Line 163: Line 161:
         }
         }
     ]
     ]
}</nowiki>|lang=javascript}}
</nowiki>}}


Most item data assets work just like <samp>Data/Objects</samp>. See also specific info for [[Modding:Fruit_trees|custom fruit trees]], [[Modding:Tools|custom tools]], and [[Modding:Weapons|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:Tools|custom tools]], and [[Modding:Weapons|melee weapons]].
Line 198: Line 196:


===Categories===
===Categories===
Each item also has a category (represented by a negative integer). In code, you can get an item's category value from <samp>item.Category</samp>, and its translated name from <samp>item.getCategoryName()</samp>. Here are the valid categories:
Each item also has a category (represented by a negative integer). In code, you can get an item's category value from <samp>item.Category</samp>, and its translated name from <samp>item.getCategoryName()</samp>. 0 can be used as a blank value. Here are the valid categories:


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 206: Line 204:
! [[Modding:Context tags|context tag]]
! [[Modding:Context tags|context tag]]
! English translation
! English translation
! Color
! Properties
! Properties
|-
|-
Line 212: Line 211:
| <samp>category_gem</samp>
| <samp>category_gem</samp>
| Mineral
| Mineral
|style="background-color:#6E005A;color:#fff;text-align:center"|<samp>#6E005A</samp>
| Affected by [[Skills#Mining|Gemologist]] profession
| Affected by [[Skills#Mining|Gemologist]] profession
|-
|-
Line 218: Line 218:
| <samp>category_fish</samp>
| <samp>category_fish</samp>
| Fish
| Fish
|style="background-color:#00008B;color:#fff;text-align:center"|<samp>#00008B</samp> (DarkBlue)
| Affected by [[Skills#Fishing|Fisher]] and [[Skills#Fishing|Angler]] professions
| Affected by [[Skills#Fishing|Fisher]] and [[Skills#Fishing|Angler]] professions
|-
|-
Line 224: Line 225:
| <samp>category_egg</samp>
| <samp>category_egg</samp>
| Animal Product
| Animal Product
|style="background-color:#FF0064;color:#000;text-align:center"|<samp>#FF0064</samp>
| Affected by [[Skills#Farming|Rancher]] profession, can be used in a slingshot
| Affected by [[Skills#Farming|Rancher]] profession, can be used in a slingshot
|-
|-
Line 230: Line 232:
| <samp>category_milk</samp>
| <samp>category_milk</samp>
| Animal Product
| Animal Product
|style="background-color:#FF0064;color:#000;text-align:center"|<samp>#FF0064</samp>
| Affected by [[Skills#Farming|Rancher]] profession
| Affected by [[Skills#Farming|Rancher]] profession
|-
|-
Line 236: Line 239:
| <samp>category_cooking</samp>
| <samp>category_cooking</samp>
| Cooking
| Cooking
|style="background-color:#DC3C00;color:#000;text-align:center"|<samp>#DC3C00</samp>
|
|
|-
|-
Line 242: Line 246:
| <samp>category_crafting</samp>
| <samp>category_crafting</samp>
| Crafting
| Crafting
|style="background-color:#943D28;color:#FFF;text-align:center">|<samp>#943D28</samp>
| Is Placeable
| Is Placeable
|-
|-
Line 247: Line 252:
| <samp>Object.BigCraftableCategory</samp>
| <samp>Object.BigCraftableCategory</samp>
| <samp>category_big_craftable</samp>
| <samp>category_big_craftable</samp>
|
|  
|  
| Is Placeable
| Is Placeable
Line 254: Line 260:
| <samp>category_minerals</samp>
| <samp>category_minerals</samp>
| Mineral
| Mineral
|style="background-color:#6E005A;color:#fff;text-align:center"|<samp>#6E005A</samp>
| Affected by [[Skills#Mining|Gemologist]] profession
| Affected by [[Skills#Mining|Gemologist]] profession
|-
|-
Line 260: Line 267:
| <samp>category_meat</samp>
| <samp>category_meat</samp>
| Animal Product
| Animal Product
|style="background-color:#FF0064;color:#000;text-align:center"|<samp>#FF0064</samp>
|
|
|-
|-
Line 266: Line 274:
| <samp>category_metal_resources</samp>
| <samp>category_metal_resources</samp>
| Resource
| Resource
|style="background-color:#406672;color:#FFF;text-align:center"|<samp>#406672</samp>
|
|
|-
|-
Line 272: Line 281:
| <samp>category_building_resources</samp>
| <samp>category_building_resources</samp>
| Resource
| Resource
|style="background-color:#406672;color:#FFF;text-align:center"|<samp>#406672</samp>
|
|
|-
|-
Line 277: Line 287:
| <samp>Object.sellAtPierres</samp>
| <samp>Object.sellAtPierres</samp>
| <samp>category_sell_at_pierres</samp>
| <samp>category_sell_at_pierres</samp>
|
|  
|  
|
|
Line 284: Line 295:
| <samp>category_sell_at_pierres_and_marnies</samp>
| <samp>category_sell_at_pierres_and_marnies</samp>
| Animal Product
| Animal Product
|style="background-color:#FF0064;color:#000;text-align:center"|<samp>#FF0064</samp>
| Affected by [[Skills#Farming|Rancher]] profession
| Affected by [[Skills#Farming|Rancher]] profession
|-
|-
Line 290: Line 302:
| <samp>category_fertilizer</samp>
| <samp>category_fertilizer</samp>
| Fertilizer
| Fertilizer
|style="background-color:#708090;color:#000;text-align:center"|<samp>#708090</samp> (SlateGray)
| Is Placeable, is always passable
| Is Placeable, is always passable
|-
|-
Line 296: Line 309:
| <samp>category_junk</samp>
| <samp>category_junk</samp>
| Trash
| Trash
|style="background-color:#696969;color:#000;text-align:center"|<samp>#696969</samp> (DimGray)
|
|
|-
|-
Line 302: Line 316:
| <samp>category_bait</samp>
| <samp>category_bait</samp>
| Bait
| Bait
|style="background-color:#8b0000;color:#FFF;text-align:center"|<samp>#8B0000</samp> (DarkRed)
| Can be attached to a fishing rod
| Can be attached to a fishing rod
|-
|-
Line 308: Line 323:
| <samp>category_tackle</samp>
| <samp>category_tackle</samp>
| Fishing Tackle
| Fishing Tackle
|style="background-color:#008b8b;color:#FFF;text-align:center"|<samp>#008B8B</samp> (DarkCyan)
| Can be attached to a fishing rod, cannot stack
| Can be attached to a fishing rod, cannot stack
|-
|-
Line 314: Line 330:
| <samp>category_sell_at_fish_shop</samp>
| <samp>category_sell_at_fish_shop</samp>
|  
|  
|
|
|
|-
|-
Line 320: Line 337:
| <samp>category_furniture</samp>
| <samp>category_furniture</samp>
| Decor
| Decor
|style="background-color:#9650be;color:#FFF;text-align:center"|<samp>#9650BE</samp>
|
|
|-
|-
Line 326: Line 344:
| <samp>category_ingredients</samp>
| <samp>category_ingredients</samp>
| Cooking
| Cooking
|
|
|
|-
|-
Line 332: Line 351:
| <samp>category_artisan_goods</samp>
| <samp>category_artisan_goods</samp>
| Artisan Goods
| Artisan Goods
|style="background-color:#009b6f;color:#000;text-align:center"|<samp>#009B6F</samp>
| Affected by [[Skills#Farming|Artisan]] profession
| Affected by [[Skills#Farming|Artisan]] profession
|-
|-
Line 338: Line 358:
| <samp>category_syrup</samp>
| <samp>category_syrup</samp>
| Artisan Goods
| Artisan Goods
|style="background-color:#009b6f;color:#000;text-align:center"|<samp>#009B6F</samp>
| Affected by [[Skills#Foraging|Tapper]] profession
| Affected by [[Skills#Foraging|Tapper]] profession
|-
|-
Line 344: Line 365:
| <samp>category_monster_loot</samp>
| <samp>category_monster_loot</samp>
| Monster Loot
| Monster Loot
|style="background-color:#320a46;color:#fff;text-align:center"|<samp>#320A46</samp>
|
|
|-
|-
Line 350: Line 372:
| <samp>category_equipment</samp>
| <samp>category_equipment</samp>
|  
|  
|
|
|
|-
|-
Line 356: Line 379:
| <samp>category_seeds</samp>
| <samp>category_seeds</samp>
| Seed
| Seed
|style="background-color:#a52a2a;color:#fff;text-align:center"|<samp>#A52A2A</samp> (Brown)
| Is Placeable, is always passable
| Is Placeable, is always passable
|-
|-
Line 362: Line 386:
| <samp>category_vegetable</samp>
| <samp>category_vegetable</samp>
| Vegetable
| Vegetable
|style="background-color:#008000;color:#FFF;text-align:center"|<samp>#008000</samp> (Green)
| Affected by [[Skills#Farming|Tiller]] profession, can be used in a slingshot
| Affected by [[Skills#Farming|Tiller]] profession, can be used in a slingshot
|-
|-
Line 368: Line 393:
| <samp>category_fruits</samp>
| <samp>category_fruits</samp>
| Fruit
| Fruit
|style="background-color:#ff1493;color:#000;text-align:center"|<samp>#FF1493</samp> (DeepPink)
| Affected by [[Skills#Farming|Tiller]] profession (if not foraged), can be used in a slingshot
| Affected by [[Skills#Farming|Tiller]] profession (if not foraged), can be used in a slingshot
|-
|-
Line 374: Line 400:
| <samp>category_flowers</samp>
| <samp>category_flowers</samp>
| Flower
| Flower
|style="background-color:#db36d3;color:#000;text-align:center"|<samp>#DB36D3</samp>
| Affected by [[Skills#Farming|Tiller]] profession
| Affected by [[Skills#Farming|Tiller]] profession
|-
|-
Line 380: Line 407:
| <samp>category_greens</samp>
| <samp>category_greens</samp>
| Forage
| Forage
|style="background-color:#0a8232;color:#FFF;text-align:center"|<samp>#0A8232</samp>
|
|
|-
|-
Line 386: Line 414:
| <samp>category_hat</samp>
| <samp>category_hat</samp>
|  
|  
|
|
|
|-
|-
Line 392: Line 421:
| <samp>category_ring</samp>
| <samp>category_ring</samp>
|  
|  
|
|
|
|-
|-
Line 398: Line 428:
| <samp>category_boots</samp>
| <samp>category_boots</samp>
|  
|  
|
|
|
|-
|-
Line 404: Line 435:
| <samp>category_weapon</samp>
| <samp>category_weapon</samp>
|  
|  
|
|
|
|-
|-
Line 410: Line 442:
| <samp>category_tool</samp>
| <samp>category_tool</samp>
|  
|  
|
|
|
|-
|-
Line 416: Line 449:
| <samp>category_clothing</samp>
| <samp>category_clothing</samp>
|  
|  
|
|
|
|-
|-
Line 422: Line 456:
| <samp>category_trinket</samp>
| <samp>category_trinket</samp>
|  
|  
|
|
|
|-
|-
Line 428: Line 463:
|  
|  
|  
|  
|style="background-color:#552f1b;color:#fff;text-align:center"|<samp>#552F1B</samp>
|
|
|-
|-
Line 434: Line 470:
|  
|  
|  
|  
|style="background-color:#7a5d27;color:#fff;text-align:center"|<samp>#7A5d27</samp>
|
|
|-
|-
Line 440: Line 477:
| <samp>category_litter</samp>
| <samp>category_litter</samp>
|  
|  
|
|
|
|}
|}
Line 470: Line 508:
bool isPufferfish = ItemRegistry.HasItemId(item, "128");
bool isPufferfish = ItemRegistry.HasItemId(item, "128");


// qualified an item ID if needed
// qualify an item ID if needed
string pufferfishQualifiedId = ItemRegistry.QualifyItemId("128"); // returns "(O)128"
string pufferfishQualifiedId = ItemRegistry.QualifyItemId("128"); // returns "(O)128"
</syntaxhighlight>
</syntaxhighlight>
Line 503: Line 541:
|-
|-
| <samp>ItemRegistry.Create</samp>
| <samp>ItemRegistry.Create</samp>
| [[#Create item instances|create an item instance]].
| [[#Create item instances|Create an item instance]].
|-
|-
| <samp>ItemRegistry.Exists</samp>
| <samp>ItemRegistry.Exists</samp>
| Get whether a qualified or unqualified item ID matches an existing item. For example:
| Get whether a qualified or unqualified item ID matches an existing item. For example:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
bool pufferfishExist = ItemRegistry.Exists("(O)128");
bool pufferfishExists = ItemRegistry.Exists("(O)128");
</syntaxhighlight>
</syntaxhighlight>
|-
|-
Line 521: Line 559:
|-
|-
| <samp>ItemRegistry.GetMetadata</samp>
| <samp>ItemRegistry.GetMetadata</samp>
| This lets you get high-level info about an item:
| Get high-level info about an item:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
// get info about Rubber Boots
// get info about Rubber Boots
ItemMetadata info = ItemRegistry.GetMetadata("(B)505");
ItemMetadata metadata = ItemRegistry.GetMetadata("(B)505");


// get item ID info
// get item ID info
$"The item has unqualified ID {info.LocalId}, qualified ID {info.QualifiedId}, and is defined by the {info.TypeIdentifier} item data definition.";
$"The item has unqualified ID {metadata.LocalId}, qualified ID {metadata.QualifiedId}, and is defined by the {metadata.TypeIdentifier} item data definition.";


// does the item exist in the data files?
// does the item exist in the data files?
bool exists = info.Exists();
bool exists = metadata.Exists();
</syntaxhighlight>
</syntaxhighlight>


Line 536: Line 574:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
// get parsed info
// get parsed info
ParsedItemData data = info.GetParsedData();
ParsedItemData data = metadata.GetParsedData();
$"The internal name is {data.InternalName}, translated name {data.DisplayName}, description {data.Description}, etc.";
$"The internal name is {data.InternalName}, translated name {data.DisplayName}, description {data.Description}, etc.";


Line 562: Line 600:
|-
|-
| <samp>ItemRegistry.GetDataOrErrorItem</samp>
| <samp>ItemRegistry.GetDataOrErrorItem</samp>
| Equivalent to <samp>ItemRegistry.GetData</samp>, except that it'll return info for an Error Item if the item doesn't exist (e.g. for drawing in inventory).
| Equivalent to <samp>ItemRegistry.GetData</samp>, except that it'll return info for an [[Error Item]] if the item doesn't exist (e.g. for drawing in inventory).
|-
|-
| <samp>ItemRegistry.GetErrorItemName</samp>
| <samp>ItemRegistry.GetErrorItemName</samp>
Line 579: Line 617:
[[Category:Modding]]
[[Category:Modding]]


[[ru:Модификации:Предметы]]
[[zh:模组:物品数据]]
[[zh:模组:物品数据]]

Latest revision as of 16:15, 4 August 2026

← Index

This page explains how the game stores and parses item data. This is an advanced guide for mod developers.

Overview

Item IDs

Every item is identified in the game data using a unique item ID. This has two forms:

  • The unqualified item ID (item.ItemId) is a unique string ID for the item, like 128 (vanilla item) or Example.ModId_Watermelon (custom item). For legacy reasons, the unqualified ID for vanilla items may not be globally unique; for example, Pufferfish (object 128) and Mushroom Box (bigcraftable 128) both have item ID 128.
  • The qualified item ID (item.QualifiedItemId) is a globally unique identifier which combines the item's type ID and unqualified item ID, like (O)128 for object ID 128.

With SMAPI installed, you can run the list_items console command in-game to search item IDs.

Note: mods created before Stardew Valley 1.6 may use the item.ParentSheetIndex field as an item identifier. This is not a valid identifier; multiple items of the same type may have the same sprite index for different textures.

Item types

Items are defined by item type data definitions, which handle parsing data of a certain type. For example, the game's ObjectDataDefinition class handles producing object-type items by parsing the Data/Objects asset.

Each definition has a unique ID like (O), which is used to form globally unique qualified item IDs. In C# code, this is tracked by the item.TypeDefinitionId field, which matches ItemRegistry.type_* constants for vanilla item types.

These are the item types for which custom items can added/edited:

item type type identifier data asset brief summary
Objects (O) Data/Objects The most common item type. Depending on their data, they can be placed in the world, picked up, eaten, sold to shops, etc.
Big craftables (BC) Data/BigCraftables Items which can be placed in the world and are two tiles tall (instead of one like objects).
Boots (B) Data/Boots Items which can be equipped in the player's boots slot. These change the player sprite and may provide buffs.
Furniture (F) Data/Furniture Decorative items which can be placed in the world. In some cases players can sit on them or place items on them.
Hats (H) Data/Hats Items which can be equipped in the player's hat slot. These change the player sprite.
Mannequins (M) Data/Mannequins Decorative items which can be placed in the world, and used to store and display clothing.
Pants (P) Data/Pants Items which can be equipped in the player's pants slot. These change the player sprite.
Shirts (S) Data/Shirts Items which can be equipped in the player's shirt slot. These change the player sprite.
Tools (T) Data/Tools Items that can be swung or used by the player to perform some effect (e.g. dig dirt, chop trees, milk or shear animals, etc).
Trinkets (TR) Data/Trinkets Items that can be equipped in the player's trinket slot to enable special effects.
Wallpaper & flooring (WP) and (FL) Data/AdditionalWallpaperFlooring Items which can be applied to a decoratable location (e.g. a farmhouse or shed) to visually change its floor or wall design. (These are separate from placeable items like brick floor.)
Weapons (W) Data/Weapons Items which can be swung or used by the player to damage monsters.

When resolving an unqualified item ID like 128, the game will get the first item type for which it exists in this order: object, big craftable, furniture, weapon, boots, hat, mannequin, pants, shirt, tool, trinket, wallpaper, and floorpaper.

Item sprites

For each item type, the game has two files in its Content folder (which can be unpacked for editing):

  • a data asset for the text data for its items (names, descriptions, prices, etc);
  • and a spritesheet for the in-game item icons.

Each item has a ParentSheetIndex 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 Characters/Farmer/hats.

Define a custom item

You can define custom items for most vanilla item types using only Content Patcher or SMAPI's content API.

For example, this content pack adds a new Pufferchick item with a custom image, custom gift tastes, and a custom crop that produces it. Note that item references in other data assets like Data/Crops and Data/NPCGiftTastes use the item ID.

{
    "Format": "2.8.0",
    "Changes": [
        // add item
        {
            "Action": "EditData",
            "Target": "Data/Objects",
            "Entries": {
                "{{ModId}}_Pufferchick": {
                    "Name": "{{ModId}}_Pufferchick", // best practice to match the ID, since it's sometimes used as an alternate ID (e.g. in Data/CraftingRecipes)
                    "Displayname": "Pufferchick",
                    "Description": "An example object.",
                    "Type": "Seeds",
                    "Category": -74,
                    "Price": 1200,

                    "Texture": "Mods/{{ModId}}/Objects",
                    "SpriteIndex": 0
                }
            }
        },

        // add gift tastes
        {
            "Action": "EditData",
            "Target": "Data/NPCGiftTastes",
            "TextOperations": [
                {
                    "Operation": "Append",
                    "Target": ["Entries", "Universal_Love"],
                    "Value": "{{ModId}}_Pufferchick",
                    "Delimiter": " " // if there are already values, add a space between them and the new one
                }
            ]
        },

        // add crop (Pufferchick is both seed and produce, like coffee beans)
        {
            "Action": "EditData",
            "Target": "Data/Crops",
            "Entries": {
                "{{ModId}}_Pufferchick": {
                    "Seasons": [ "spring", "summer", "fall" ],
                    "DaysInPhase": [ 1, 1, 1, 1, 1 ],
                    "HarvestItemId": "{{ModId}}_Pufferchick",

                    "Texture": "Mods/{{ModId}}/Crops",
                    "SpriteIndex": 0
                }
            }
        },

        // add item + crop images
        {
            "Action": "Load",
            "Target": "Mods/{{ModId}}/Crops, Mods/{{ModId}}/Objects",
            "FromFile": "assets/{{TargetWithoutPath}}.png" // assets/Crops.png, assets/Objects.png
        }
    ]
}

Most item data assets work just like Data/Objects. See also specific info for custom fruit trees, custom tools, and melee weapons.

Error items

When an item is broken (e.g. due to deleting the mod which adds it), it's represented in-game as a default Error Item with a 🛇 sprite. This keeps the previous item data in case the item data is re-added.

Common data

Quality

Each item has a quality level which (depending on the item type) may affect its price, health boost, etc. The valid qualities are:

quality value constant
normal 0 Object.lowQuality
silver 1 Object.medQuality
gold 2 Object.highQuality
iridium 4 Object.bestQuality

Categories

Each item also has a category (represented by a negative integer). In code, you can get an item's category value from item.Category, and its translated name from item.getCategoryName(). 0 can be used as a blank value. Here are the valid categories:

value internal constant context tag English translation Color Properties
-2 Object.GemCategory category_gem Mineral #6E005A Affected by Gemologist profession
-4 Object.FishCategory category_fish Fish #00008B (DarkBlue) Affected by Fisher and Angler professions
-5 Object.EggCategory category_egg Animal Product #FF0064 Affected by Rancher profession, can be used in a slingshot
-6 Object.MilkCategory category_milk Animal Product #FF0064 Affected by Rancher profession
-7 Object.CookingCategory category_cooking Cooking #DC3C00
-8 Object.CraftingCategory category_crafting Crafting #943D28 Is Placeable
-9 Object.BigCraftableCategory category_big_craftable Is Placeable
-12 Object.mineralsCategory category_minerals Mineral #6E005A Affected by Gemologist profession
-14 Object.meatCategory category_meat Animal Product #FF0064
-15 Object.metalResources category_metal_resources Resource #406672
-16 Object.buildingResources category_building_resources Resource #406672
-17 Object.sellAtPierres category_sell_at_pierres
-18 Object.sellAtPierresAndMarnies category_sell_at_pierres_and_marnies Animal Product #FF0064 Affected by Rancher profession
-19 Object.fertilizerCategory category_fertilizer Fertilizer #708090 (SlateGray) Is Placeable, is always passable
-20 Object.junkCategory category_junk Trash #696969 (DimGray)
-21 Object.baitCategory category_bait Bait #8B0000 (DarkRed) Can be attached to a fishing rod
-22 Object.tackleCategory category_tackle Fishing Tackle #008B8B (DarkCyan) Can be attached to a fishing rod, cannot stack
-23 Object.sellAtFishShopCategory category_sell_at_fish_shop
-24 Object.furnitureCategory category_furniture Decor #9650BE
-25 Object.ingredientsCategory category_ingredients Cooking
-26 Object.artisanGoodsCategory category_artisan_goods Artisan Goods #009B6F Affected by Artisan profession
-27 Object.syrupCategory category_syrup Artisan Goods #009B6F Affected by Tapper profession
-28 Object.monsterLootCategory category_monster_loot Monster Loot #320A46
-29 Object.equipmentCategory category_equipment
-74 Object.SeedsCategory category_seeds Seed #A52A2A (Brown) Is Placeable, is always passable
-75 Object.VegetableCategory category_vegetable Vegetable #008000 (Green) Affected by Tiller profession, can be used in a slingshot
-79 Object.FruitsCategory category_fruits Fruit #FF1493 (DeepPink) Affected by Tiller profession (if not foraged), can be used in a slingshot
-80 Object.flowersCategory category_flowers Flower #DB36D3 Affected by Tiller profession
-81 Object.GreensCategory category_greens Forage #0A8232
-95 Object.hatCategory category_hat
-96 Object.ringCategory category_ring
-97 Object.bootsCategory category_boots
-98 Object.weaponCategory category_weapon
-99 Object.toolCategory category_tool
-100 Object.clothingCategory category_clothing
-101 Object.trinketCategory category_trinket
-102 Object.booksCategory #552F1B
-103 Object.skillBooksCategory #7A5d27
-999 Object.litterCategory category_litter
Console commands 
With the Console Code mod installed, you can run this command in the SMAPI console to see a list of objects by category:
cs return string.Join(`\n`, Game1.objectData.Keys.Select(key => new StardewValley.Object(key, 1)).GroupBy(item => item.Category, item => item.Name).OrderByDescending(p => p.Key).Select(p => $`{p.Key}: {string.Join(`, `, p.OrderBy(name => name))}`));

Context tags

A context tag is an arbitrary data label like category_gem or item_apple attached to items. These provide metadata about items (e.g. their color, quality, category, general groupings like alcohol or fish, etc), and may affect game logic (e.g. machine processing).

See Modding:Context tags for more info.

Specific item types

For docs about each item type (e.g. objects or weapons), see the item types table above.

For C# mods

Identify items

You can uniquely identify items by checking their item ID fields. For example:

bool isPufferfish = item.QualifiedItemId == "(O)128";

The ItemRegistry class also provides methods to work with items. For example:

// check if item would be matched by a qualified or unqualified item ID
bool isPufferfish = ItemRegistry.HasItemId(item, "128");

// qualify an item ID if needed
string pufferfishQualifiedId = ItemRegistry.QualifyItemId("128"); // returns "(O)128"

Note that flavored items like jellies and wine don't have their own ID. For example, Blueberry Wine and Wine are both (O)348. You can get the flavor item ID from the preservedParentSheetIndex field; for example, Blueberry Wine will have the item ID for blueberry. (Despite the name, it contains the item's ID rather than its ParentSheetIndex).

Create item instances

The ItemRegistry.Create method is the main way to construct items. For example:

Item pufferfish = ItemRegistry.Create("(O)128"); // can optionally specify count and quality

If the ID doesn't match a real item, the ItemRegistry will return an Error Item by default. You can override that by setting allowNull: true when calling the method.

You can also get a specific value type instead of Item if needed. This will throw a descriptive exception if the type isn't compatible (e.g. you try to convert furniture to boots).

Boots boots = ItemRegistry.Create<Boots>("(B)505"); // Rubber Boots

When creating an item manually instead, make sure to pass its ItemId (not QualifiedItemId) to the constructor. For example:

Item pufferfish = new Object("128", 1);

Work with item metadata

The ItemRegistry class provides several methods for working with item metadata. Some useful methods include:

method effect
ItemRegistry.Create Create an item instance.
ItemRegistry.Exists Get whether a qualified or unqualified item ID matches an existing item. For example:
bool pufferfishExists = ItemRegistry.Exists("(O)128");
ItemRegistry.IsQualifiedId Get whether the given item ID is qualified with the type prefix (like (O)128 instead of 128).
ItemRegistry.QualifyItemId Get the unique qualified item ID given an unqualified or qualified one. For example:
string qualifiedId = ItemRegistry.QualifyItemId("128"); // returns (O)128
ItemRegistry.GetMetadata Get high-level info about an item:
// get info about Rubber Boots
ItemMetadata metadata = ItemRegistry.GetMetadata("(B)505");

// get item ID info
$"The item has unqualified ID {metadata.LocalId}, qualified ID {metadata.QualifiedId}, and is defined by the {metadata.TypeIdentifier} item data definition.";

// does the item exist in the data files?
bool exists = metadata.Exists();

And get common parsed item data:

// get parsed info
ParsedItemData data = metadata.GetParsedData();
$"The internal name is {data.InternalName}, translated name {data.DisplayName}, description {data.Description}, etc.";

// draw an item sprite
Texture2D texture = data.GetTexture();
Rectangle sourceRect = data.GetSourceRect();
spriteBatch.Draw(texture, Vector2.Zero, sourceRect, Color.White);

And create an item:

Item item = metadata.CreateItem();

And get the type definition (note that this is very specialized, and you should usually use ItemRegistry instead to benefit from its caching and optimizations):

IItemDataDefinition typeDefinition = info.GetTypeDefinition();
ItemRegistry.ResolveMetadata Equivalent to ItemRegistry.GetMetadata, except that it'll return null if the item doesn't exist.
ItemRegistry.GetData Get the parsed data about an item, or null if the item doesn't exist. This is a shortcut for ItemRegistry.ResolveMetadata(id)?.GetParsedData(); see the previous method for info on the parsed data.
ItemRegistry.GetDataOrErrorItem Equivalent to ItemRegistry.GetData, except that it'll return info for an Error Item if the item doesn't exist (e.g. for drawing in inventory).
ItemRegistry.GetErrorItemName Get a translated Error Item label.

Define custom item types

You can implement IItemDataDefinition for your own item type, and call ItemRegistry.AddTypeDefinition to register it. This provides all the logic needed by the game to handle the item type: where to get item data, how to draw them, etc.

This is extremely specialized, and multiplayer compatibility is unknown. Most mods should add custom items within the existing types instead.

See also