Jump to content

Modding:Objects: Difference between revisions

From Stardew Valley Wiki
imported>BarleyZP
imported>Zeltron0012
m removed a duplicate mention of CombatLevel in custom attributes
 
(56 intermediate revisions by 12 users not shown)
Line 1: Line 1:
← [[Modding:Index|Index]]
← [[Modding:Items|Items]]


This page explains how the game stores and parses item data. This is an advanced guide for mod developers.
This page explains how the game stores and parses object-type item data. For items in general, see [[Modding:Items]].


==Introduction==
==Overview==
Objects are the default type for items in inventories or in the world. Depending on their data, they can be placed, picked up, eaten, sold to shops, etc.


===Overview===
They have [[Modding:Items#Item types|item type]] <code>(O)</code> (or <code>ItemRegistry.type_object</code> in C# code), their data in <samp>Data/Objects</samp>, their icon sprites in <samp>Maps/springobjects</samp> or <samp>TileSheets/Objects_2</samp> by default, and their code in <samp>StardewValley.Object</samp>. See [[/Object sprites|a table of sprites and their corresponding indexes]].
As of Stardew Valley 1.6, there are a few important features of Items in the game.


# 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.
==Data format==
# 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.
 
In other words, the four important fields for items are:
 
{| class="wikitable"
|-
! name
! type
! description
|-
| <samp>ItemId</samp>
| <samp>string</samp>
| A [[Modding:Common data field types#Unique string ID|unique string ID]] for this item which should be globally unique (but may not be for existing vanilla items for backwards compatibility). For example, <samp>128</samp> (vanilla item) or <samp>Example.ModId_Watermelon</samp> (custom item).
|-
| <samp>QualifiedItemId</samp>
| <samp>string</samp>
| A globally unique item key, like <samp>(O)128</samp> for a vanilla item or <samp>(O)Example.ModId_Watermelon</samp> for a custom one. This is auto-generated from the <samp>TypeDefinitionId</samp> and <samp>ItemId</samp> fields.
|-
| <samp>ParentSheetIndex</samp>
| <samp>int</samp>
| The item's sprite index within its spritesheet.
|-
| <samp>TypeDefinitionId</samp>
| <samp>string</samp>
| The ID for the data definition which defines the item, like <samp>(O)</samp> for an object. You can use <samp>ItemRegistry.type_*</samp> constants with this field:
<syntaxhighlight lang="c#">
if (item.TypeDefinitionId == ItemRegistry.type_object)
  ...
</syntaxhighlight>
|}
 
===Item references===
Item references throughout the game code now use the <samp>ItemId</samp> instead of the <samp>ParentSheetIndex</samp>. Since the <samp>ItemId</samp> is identical to the index for existing vanilla items, most data assets are unaffected by this change. For example, here's from <samp>Data/NPCGiftTastes</samp> with one custom item:
<syntaxhighlight lang="json">
"Universal_Like": "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459 Example.ModID_watermelon"
</syntaxhighlight>
 
Unless otherwise noted, unqualified item IDs will produce [[Modding:Items|objects]]. Some assets let you override that by specifying a <samp>QualifiedItemId</samp> value instead. For example, you can add <code>(O)128</code> to the gift taste list to explicitly add for an object. Here's a partial list of data assets and their supported item ID formats:
 
{| class="wikitable"
|-
! data asset
! item ID format
|-
| [[Modding:Recipe data|<samp>Data/CraftingRecipes</samp><br /><samp>Data/CookingRecipes</samp>]]
| &#32;
* Ingredients: both supported.
* Output: set field 2 to the unqualified item ID, and field 3 to one of <samp>true</samp> (bigcraftable) or <samp>false</samp> (object).
|-
| [[Modding:Fruit_trees|<samp>Data/FruitTrees</samp>]]
| &#32;
* Fruit: both supported.
* Sapling: unqualified only.
|-
| [[Modding:Gift taste data|<samp>Data/NPCGiftTastes</samp>]]
| Both supported, but only <samp>(O)</samp> items can be gifted.
|}
 
===Item types===
These are the item types for which custom items can added/edited:
 
{| class="wikitable"
|-
! item type
! type identifier
! data asset
|-
| [[Modding:Items#Big_craftables|Big craftables]]
| <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>
|-
| [[Modding:Items#Boots|Boots]]
| <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>
|-
| [[Modding:Crop data|Crops]]
| <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>
|-
| [[Modding:Fish data|Fish (in fish tanks)]]
| <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>
|-
| [[Modding:Items#Furniture|Furniture]]
| <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>
|-
| [[Modding:Fruit_trees|Fruit Trees]]
| <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>
|-
| [[Modding:Items#Hats|Hats]]
| <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>
|-
| [[Modding:Items#Objects|Objects]]
| <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>
|-
| [[Modding:Items#Pants|Pants]]
| <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>
|-
| [[Modding:Items#Shirts|Shirts]]
| <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>
 
<small>Shirt textures must be exactly 256 pixels wide, divided into two halves: the left half for the shirt sprites, and the right half for any dye masks. The remaining space can be left blank if needed.</small>
<pre>
      sprites      dye masks
  /-----------\  /-----------\
┌────────────────────────────────┐
│ ┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐ │
│ │ 0 ││ 1 ││ 2 ││ a ││ b ││ c │ │
│ └───┘└───┘└───┘└───┘└───┘└───┘ │
│ ┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐ │
│ │ 3 ││ 4 ││ 5 ││ d ││ e ││ f │ │
│ └───┘└───┘└───┘└───┘└───┘└───┘ │
└────────────────────────────────┘
</pre>
|-
| [[#Custom tools|Tools]]
| <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>
|-
| Wallpaper & flooring
| <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>
|-
| [[Modding:Items#Weapons|Weapons]]
| <samp>(W)</samp>
| <samp>Data/Weapons</samp><br />
|}
 
When resolving an unqualified item ID like <samp>128</samp>, the game will get the first item type for which it exists in this order: object, big craftable, furniture, weapon, boots, hat, pants, shirt, tool, wallpaper, and floorpaper.
 
For each item type, the game has two files in its <samp>Content</samp> folder (which can be [[Modding:Editing XNB files#unpacking|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 <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>.
 
===Get a list of items===
With [[Modding:Player Guide/Getting Started|SMAPI installed]], you can [[Modding:Console commands#Console commands|run the <samp>list_items</samp> console command]] in-game to view/search items and their IDs.
 
===Define a custom item===
You can define custom items for most vanilla item types using only [[Modding:Content Patcher|Content Patcher]] or [[Modding:Modder Guide/APIs/Content|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 <samp>Data/Crops</samp> and <samp>Data/NPCGiftTastes</samp> use the item ID.
 
{{#tag:syntaxhighlight|<nowiki>
{
    "Format": "</nowiki>{{Content Patcher version}}<nowiki>",
    "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
        }
    ]
}</nowiki>|lang=javascript}}
 
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===
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 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===
<dl style="margin-left: 2em;">
 
<dt>Compare items</dt>
<dd>
Since <samp>Item.QualifiedItemId</samp> is globally unique, it can be used to simplify comparing items. For example:
 
{| class="wikitable"
|-
! old code
! new code
|-
|-
| <samp>item.ParentSheetIndex == 128</samp>
| <samp>item.QualifiedItemId == "(O)128"</samp>
|-
| <samp>IsNormalObjectAtParentSheetIndex(item, 128)</samp>
| <samp>item.QualifiedItemId == "(O)128"</samp>
|-
| <samp>!item.bigCraftable && item.ParentSheetIndex == 128</samp>
| <samp>item.QualifiedItemId == "(O)128"</samp>
|-
| <samp>item is Boots && item.ParentSheetIndex == 505</samp>
| <samp>item.QualifiedItemId == "(B)505"</samp>
|}
 
You can also use <samp>ItemRegistry.QualifyItemId</samp> to convert any item ID into a qualified one (if it's valid), and <samp>ItemRegistry.HasItemId</samp> to check if an item has a qualified or unqualified item ID.
 
Note that flavored item don't have their own ID. For example, Blueberry Wine and Wine are both <samp>(O)348</samp>. This affects flavored jellies, juices, pickles, and wines. In those cases you should still compare their separate fields like <samp>preservedParentSheetIndex</samp> (which actually contains the preserved item's <samp>ItemId</samp>, not its <samp>ParentSheetIndex</samp>).
</dd>
 
<dt>Construct items</dt>
<dd>When constructing items, specify the item's <samp>ItemId</samp> (''not'' <samp>QualifiedItemId</samp>). For example:
 
<syntaxhighlight lang="c#">
new Object("128", 1);                      // vanilla item
new Object("Example.ModId_Watermelon", 1); // custom item
</syntaxhighlight>
 
You can use a utility method to construct items from their <samp>QualifiedItemId</samp>:
 
<syntaxhighlight lang="c#">
Item item = ItemRegistry.Create("(B)505"); // Rubber Boots
</syntaxhighlight>
</dd>
 
<dt>Define custom item types</dt>
<dd>You can implement <samp>IItemDataDefinition</samp> for your own item type, and call <samp>ItemRegistry.AddTypeDefinition</samp> 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.</dd>
 
<dt>New <samp>Is*</samp> methods</dt>
<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"
|-
! method
! effect
|-
| <samp>object.IsBar()</samp>
| Whether the item is a [[Copper Bar|copper bar]], [[Iron Bar|iron bar]], [[Gold Bar|gold bar]], [[Iridium Bar|iridium bar]], or [[Radioactive Bar|radioactive bar]].
|-
| <samp>object.IsBreakableStone()</samp>
| Whether the item is a stone debris item which can be broken by a pickaxe.
|-
| <samp>object.IsFence()</samp>
| Whether the item is a [[Crafting#Fences|fence]].
|-
| <samp>object.IsFruitTreeSapling()</samp>
| Whether the item is a [[Fruit Trees|fruit tree]] sapling. This checks the <samp>Data\fruitTrees</samp> keys, so it works with custom fruit trees too.
|-
| <samp>object.IsHeldOverHead()</samp>
| Whether the player is shown holding up the item when it's selected in their toolbar. Default true (except for furniture).
|-
| <samp>object.IsIncubator()</samp>
| Whether the item can incubate [[Animals|farm animal]] eggs when placed in a building.
|-
| <samp>object.IsTapper()</samp>
| Whether the item is a [[Tapper|tapper]] or [[Heavy Tapper|heavy tapper]].
|-
| <samp>object.IsTeaSapling()</samp>
| Whether the item is a [[Tea Sapling|tea sapling]].
|-
| <samp>object.IsTwig()</samp>
| Whethere the item is a twig debris item.
|-
| <samp>object.IsWeeds()</samp>
| Whether the item is a weed debris item.
|}
</dd>
 
<dt>Work with item metadata</dt>
<dd>
1.6 added an <samp>ItemRegistry</samp> API for working with the new item system. Some of the provided methods are:
 
{| class="wikitable"
|-
! method
! effect
|-
| <samp>ItemRegistry.Create</samp>
| Create an item from its item ID (qualified or unqualified). If the ID doesn't match a real item, the optional <samp>allowNull</samp> parameter indicates whether to return null or an Error Item. For example:
<syntaxhighlight lang="c#">
Item item = ItemRegistry.Create("(B)505"); // Rubber Boots
</syntaxhighlight>
 
You can also get a specific value type instead of <samp>Item</samp> if needed. This will throw a descriptive exception if the type isn't compatible (e.g. you try to convert furniture to boots).
<syntaxhighlight lang="c#">
Boots item = ItemRegistry.Create<Boots>("(B)505"); // Rubber Boots
</syntaxhighlight>
|-
| <samp>ItemRegistry.Exists</samp>
| Get whether a qualified or unqualified item ID matches an existing item. For example:
<syntaxhighlight lang="c#">
bool pufferfishExist = ItemRegistry.Exists("(O)128");
</syntaxhighlight>
|-
| <samp>ItemRegistry.IsQualifiedId</samp>
| Get whether the given item ID is qualified with the type prefix (like <samp>(O)128</samp> instead of <samp>128</samp>).
|-
| <samp>ItemRegistry.QualifyItemId</samp>
| Get the unique qualified item ID given an unqualified or qualified one. For example:
<syntaxhighlight lang="c#">
string qualifiedId = ItemRegistry.QualifyItemId("128"); // returns (O)128
</syntaxhighlight>
|-
| <samp>ItemRegistry.GetMetadata</samp>
| This lets you get high-level info about an item:
<syntaxhighlight lang="c#">
// get info about Rubber Boots
ItemMetadata info = ItemRegistry.GetMetadata("(B)505");
 
// 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.";
 
// does the item exist in the data files?
bool exists = info.Exists();
</syntaxhighlight>
 
And get common parsed item data:
<syntaxhighlight lang="c#">
// get parsed info
ParsedItemData data = info.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);
</syntaxhighlight>
 
And create an item:
<syntaxhighlight lang="c#">
Item item = metadata.CreateItem();
</syntaxhighlight>
 
And get the type definition (note that this is very specialized, and you should usually use <samp>ItemRegistry</samp> instead to benefit from its caching and optimizations):
<syntaxhighlight lang="c#">
IItemDataDefinition typeDefinition = info.GetTypeDefinition();
</syntaxhighlight>
|-
| <samp>ItemRegistry.ResolveMetadata</samp>
| Equivalent to <samp>ItemRegistry.GetMetadata</samp>, except that it'll return null if the item doesn't exist.
|-
| <samp>ItemRegistry.GetData</samp>
| Get the parsed data about an item, or <samp>null</samp> if the item doesn't exist. This is a shortcut for <code>ItemRegistry.ResolveMetadata(id)?.GetParsedData()</code>; see the previous method for info on the parsed data.
|-
| <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).
|-
| <samp>ItemRegistry.GetErrorItemName</samp>
| Get a translated ''Error Item'' label.
|}
</dd>
</dl>
 
==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:
 
{| class="wikitable"
|-
! quality
! value
! constant
|-
| normal
| <samp>0</samp>
| <samp>Object.lowQuality</samp>
|-
| silver
| <samp>1</samp>
| <samp>Object.medQuality</samp>
|-
| gold
| <samp>2</samp>
| <samp>Object.highQuality</samp>
|-
| iridium
| <samp>4</samp>
| <samp>Object.bestQuality</samp>
|}
 
===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:
 
{| class="wikitable sortable"
|-
! value
! internal constant
! [[#Context tags|context tag]]
! English translation
! Properties
|-
| -2
| <samp>Object.GemCategory</samp>
| <samp>category_gem</samp>
| Mineral
| Affected by [[Skills#Mining|Gemologist]] profession
|-
| -4
| <samp>Object.FishCategory</samp>
| <samp>category_fish</samp>
| Fish
| Affected by [[Skills#Fishing|Fisher]] and [[Skills#Fishing|Angler]] professions
|-
| -5
| <samp>Object.EggCategory</samp>
| <samp>category_egg</samp>
| Animal Product
| Affected by [[Skills#Farming|Rancher]] profession, can be used in a slingshot
|-
| -6
| <samp>Object.MilkCategory</samp>
| <samp>category_milk</samp>
| Animal Product
| Affected by [[Skills#Farming|Rancher]] profession
|-
| -7
| <samp>Object.CookingCategory</samp>
| <samp>category_cooking</samp>
| Cooking
|
|-
| -8
| <samp>Object.CraftingCategory</samp>
| <samp>category_crafting</samp>
| Crafting
| Is Placeable
|-
| -9
| <samp>Object.BigCraftableCategory</samp>
| <samp>category_big_craftable</samp>
|
| Is Placeable
|-
| -12
| <samp>Object.mineralsCategory</samp>
| <samp>category_minerals</samp>
| Mineral
| Affected by [[Skills#Mining|Gemologist]] profession
|-
| -14
| <samp>Object.meatCategory</samp>
| <samp>category_meat</samp>
| Animal Product
|
|-
| -15
| <samp>Object.metalResources</samp>
| <samp>category_metal_resources</samp>
| Resource
|
|-
| -16
| <samp>Object.buildingResources</samp>
| <samp>category_building_resources</samp>
| Resource
|
|-
| -17
| <samp>Object.sellAtPierres</samp>
| <samp>category_sell_at_pierres</samp>
|
|
|-
| -18
| <samp>Object.sellAtPierresAndMarnies</samp>
| <samp>category_sell_at_pierres_and_marnies</samp>
| Animal Product
| Affected by [[Skills#Farming|Rancher]] profession
|-
| -19
| <samp>Object.fertilizerCategory</samp>
| <samp>category_fertilizer</samp>
| Fertilizer
| Is Placeable, is always passable
|-
| -20
| <samp>Object.junkCategory</samp>
| <samp>category_junk</samp>
| Trash
|
|-
| -21
| <samp>Object.baitCategory</samp>
| <samp>category_bait</samp>
| Bait
| Can be attached to a fishing rod
|-
| -22
| <samp>Object.tackleCategory</samp>
| <samp>category_tackle</samp>
| Fishing Tackle
| Can be attached to a fishing rod, cannot stack
|-
| -23
| <samp>sellAtFishShopCategory</samp>
| <samp>category_sell_at_fish_shop</samp>
|
|
|-
| -24
| <samp>Object.furnitureCategory</samp>
| <samp>category_furniture</samp>
| Decor
|
|-
| -25
| <samp>Object.ingredientsCategory</samp>
| <samp>category_ingredients</samp>
| Cooking
|
|-
| -26
| <samp>Object.artisanGoodsCategory</samp>
| <samp>category_artisan_goods</samp>
| Artisan Goods
| Affected by [[Skills#Farming|Artisan]] profession
|-
| -27
| <samp>Object.syrupCategory</samp>
| <samp>category_syrup</samp>
| Artisan Goods
| Affected by [[Skills#Foraging|Tapper]] profession
|-
| -28
| <samp>Object.monsterLootCategory</samp>
| <samp>category_monster_loot</samp>
| Monster Loot
|
|-
| -29
| <samp>Object.equipmentCategory</samp>
| <samp>category_equipment</samp>
|
|
|-
| -74
| <samp>Object.SeedsCategory</samp>
| <samp>category_seeds</samp>
| Seed
| Is Placeable, is always passable
|-
| -75
| <samp>Object.VegetableCategory</samp>
| <samp>category_vegetable</samp>
| Vegetable
| Affected by [[Skills#Farming|Tiller]] profession, can be used in a slingshot
|-
| -79
| <samp>Object.FruitsCategory</samp>
| <samp>category_fruits</samp>
| Fruit
| Affected by [[Skills#Farming|Tiller]] profession (if not foraged), can be used in a slingshot
|-
| -80
| <samp>Object.flowersCategory</samp>
| <samp>category_flowers</samp>
| Flower
| Affected by [[Skills#Farming|Tiller]] profession
|-
| -81
| <samp>Object.GreensCategory</samp>
| <samp>category_greens</samp>
| Forage
|
|-
| -95
| <samp>Object.hatCategory</samp>
| <samp>category_hat</samp>
|
|
|-
| -96
| <samp>Object.ringCategory</samp>
| <samp>category_ring</samp>
|
|
|-
| -98
| <samp>Object.weaponCategory</samp>
| <samp>category_weapon</samp>
|
|
|-
| -99
| <samp>Object.toolCategory</samp>
| <samp>category_tool</samp>
|
|
|}
 
{{collapse|Console commands|content=
With the {{nexus mod|3101|Console Code}} mod installed, you can run this command in the SMAPI console to see a list of objects by category:
 
<pre>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))}`));</pre>
}}
 
===Context tags===
A ''context tag'' is an arbitrary data label attached to items. These can produce various effects in-game, or may be informational only.
 
The game generates some tags based on the game data (like the item quality), and others are defined in the <samp>Data/ObjectContextTags</samp> data asset (which consists of a string→string dictionary, where the key is the item's internal name ''or'' the alternative ID matching the <samp>id_{{t|type}}_{{t|identifier}}</samp> tag, and the value is a comma-delimited list of tags to add).
 
Here's an ''incomplete'' list of context tags added or used in the base game. Mods can add custom context tags, which aren't listed here.
 
<dl style="margin-left: 2em;">
<dt>Added automatically for all items:</dt>
<dd>
{| class="wikitable"
|-
! context tag
! effect
|-
| <samp>category_{{t|category}}</samp>
| Added automatically based on the item category. See the 'context tag' column in the [[#Categories|item category list]] for possible values.
|-
| <samp>fish_{{t|metadata}}</samp>
| Added automatically for a fish item based on [[Modding:Fish data|its metadata in <samp>Data/Fish</samp>]].
 
For [[Crab Pot|crab pot]] fish (''i.e.'' those with type <samp>trap</samp>):
 
{| class="wikitable"
|-
! context tag
! notes
|-
| <samp>fish_trap_location_{{t|water type}}</samp>
| Based on field 2 ('darting randomness'). For example, <samp>fish_trap_location_ocean</samp>.
|}
 
For fishing rod fish (''i.e.'' those whose type is ''not'' <samp>trap</samp>):
{| class="wikitable"
|-
! context tag
! notes
|-
| <samp>fish_difficulty_{{t|difficulty}}</samp>
| Based on field 1 ('chance to dart'), where {{t|difficulty}} is one of <samp>easy</samp> (0–33), <samp>medium</samp> (34–66), <samp>hard</samp> (67–100), or <samp>extremely_hard</samp> (101+). For example, <samp>fish_difficulty_hard</samp>.
|-
| <samp>fish_motion_{{t|motion}}</samp>
| Based on field 4 ('location'). For example, <samp>fish_motion_floater</samp>.
|-
| <samp>fish_favor_weather_{{t|weather}}</samp>
| Based on field 7 ('weather'). For example, <samp>fish_favor_weather_sunny</samp>.
|}
|-
| <samp>id_{{t|type}}_{{t|identifier}}</samp>
| Added automatically as an alternative ID. The {{t|type}} is one of <samp>B</samp> (boots), <samp>BBL</samp> (big craftable recipe), <samp>BL</samp> (object recipe), <samp>BO</samp> (big craftable), <samp>C</samp> (clothing), <samp>F</samp> (furniture), <samp>H</samp> (hat), <samp>O</samp> (object), <samp>R</samp> (ring), <samp>W</samp> (melee weapon), else blank. The {{t|identifier}} is the item's parent sheet index. For example, [[pufferfish]] has value <samp>id_o_128</samp> (object #128).
|-
| <samp>item_{{t|name}}</samp>
| Added automatically based on the item name. The name is trimmed, lowercase, with spaces replaced with underscores, and with single quotes removed. For example, [['1000 Years From Now']] has context tag <samp>item_1000_years_from_now</samp>.
|}
</dd>
 
<dt>Added automatically for [[#Objects|object-type]] items:</dt>
<dd>
{| class="wikitable"
|-
! context tag
! effect
|-
| <samp>jelly_item</samp><br /><samp>juice_item</samp><br /><samp>pickle_item</samp><br /><samp>wine_item</samp>
| For items produced by the [[keg]] or [[Preserves Jar|preserves jar]], the preserved item type.
|-
| <samp>preserve_sheet_index_{{t|id}}</samp>
| For items produced by the [[keg]] or [[Preserves Jar|preserves jar]], the parent sheet index for the original item that was produced. For example, blueberry [[wine]] has <samp>preserve_sheet_index_258</samp>, where 258 is the [[blueberry]] item's index.
|-
| <samp>quality_none</samp><br /><samp>quality_silver</samp><br /><samp>quality_gold</samp><br /><samp>quality_iridium</samp>
| Added automatically based on the item quality.
|-
| <samp>quality_qi</samp>
| Added automatically for items cooked while the [[Quests|''Qi's Cuisine'' special order]] is active.
|}
</dd>
 
<dt>Context tags from <samp>Data/ObjectContextTags</samp>:</dt>
<dd>
{| class="wikitable"
|-
! context tag
! effect
|-
| <samp>color_*</samp>
| The color produced by this item when the player [[Dyeing#Dye Pots|dyes clothing]] at [[2 Willow Lane|Emily's house]]. The context tag only affects which of the six color dye pots it can be placed in; for example, <samp>color_red</samp> and <samp>color_dark_red</samp> are both placed in the red pot, but they don't produce different colors.
 
{| class="wikitable"
|-
! dye pot
! context tags
|-
| red
| <samp>color_red</samp>, <samp>color_salmon</samp>, <samp>color_dark_red</samp>, <samp>color_pink</samp>
|-
| orange
| <samp>color_orange</samp>, <samp>color_dark_orange</samp>, <samp>color_dark_brown</samp>, <samp>color_brown</samp>, <samp>color_copper</samp>
|-
| yellow
| <samp>color_yellow</samp>, <samp>color_dark_yellow</samp>, <samp>color_gold</samp>, <samp>color_sand</samp>
|-
| green
| <samp>color_green</samp>, <samp>color_dark_green</samp>, <samp>color_lime</samp>, <samp>color_yellow_green</samp>, <samp>color_jade</samp>
|-
| blue
| <samp>color_blue</samp>, <samp>color_dark_blue</samp>, <samp>color_dark_cyan</samp>, <samp>color_light_cyan</samp>, <samp>color_cyan</samp>, <samp>color_aquamarine</samp>
|-
| purple
| <samp>color_purple</samp>, <samp>color_dark_purple</samp>, <samp>color_dark_pink</samp>, <samp>color_pale_violet_red</samp>, <samp>color_poppyseed</samp>, <samp>color_iridium</samp>
|}
|}
</dd>
</dl>
 
Some game data also references context tags in a generic way. For example, you can add custom tags for an item to <samp>Data/ObjectContextTags</samp>, then reference them in the fish pond data. Specifically:
 
{| class="wikitable"
|-
! game data
! effects
|-
| [[Modding:Fish Pond data|fish ponds]]
| In <samp>Data/FishPondData</samp>, used to match fish that can be placed in the pond (see [[Modding:Fish Pond data#RequiredTags|<samp>RequiredTags</samp> in the fish pond data]]).
|-
| [[Modding:Special orders|special orders]]
| In <samp>Data/SpecialOrders</samp>, used to match items that meet the quest objectives (see [[Modding:Special orders#Context tags|<samp>AcceptedContextTags</samp> in the special order data]]).
|-
| tailoring
| In <samp>Data/TailoringRecipes</samp>, used to match items that are needed for a recipe.
|-
| [[Modding:Gift taste data|gift tastes]]
| In <samp>Data/NPCGiftTastes</samp>, used to set character likes and dislike for every item using the context tag.
|}
 
 
The <samp>debug listtags</samp> [[Modding:Console commands|console command]] lists all the tags of the item being held.
 
{{collapse|raw tag dump|content=Here's a list of context tags extracted from <samp>Data/ObjectContextTags</samp> that aren't listed above yet: <samp>alcohol_item</samp>, <samp>algae_item</samp>, <samp>ancient_item</samp>, <samp>beach_item</samp>, <samp>bomb_item</samp>, <samp>bone_item</samp>, <samp>book_item</samp>, <samp>ceramic_item</samp>, <samp>chicken_item</samp>, <samp>color_black</samp>, <samp>color_dark_gray</samp>, <samp>color_gray</samp>, <samp>color_iron</samp>, <samp>color_prismatic</samp>, <samp>color_white</samp>, <samp>cooking_item</samp>, <samp>cow_milk_item</samp>, <samp>cowboy_item</samp>, <samp>crop_year_2</samp>, <samp>dinosaur_item</samp>, <samp>doll_item</samp>, <samp>drink_item</samp>, <samp>dwarvish_item</samp>, <samp>dye_medium</samp>, <samp>dye_strong</samp>, <samp>egg_item</samp>, <samp>elvish_item</samp>, <samp>fertilizer_item</samp>, <samp>fish_bug_lair</samp>, <samp>fish_carnivorous</samp>, <samp>fish_crab_pot</samp>, <samp>fish_desert</samp>, <samp>fish_freshwater</samp>, <samp>fish_lake</samp>, <samp>fish_legendary</samp>, <samp>fish_mines</samp>, <samp>fish_night_market</samp>, <samp>fish_nonfish</samp>, <samp>fish_ocean</samp>, <samp>fish_pond</samp>, <samp>fish_river</samp>, <samp>fish_secret_pond</samp>, <samp>fish_semi_rare</samp>, <samp>fish_sewers</samp>, <samp>fish_swamp</samp>, <samp>fish_talk_demanding</samp>, <samp>fish_talk_rude</samp>, <samp>fish_talk_stiff</samp>, <samp>fish_upright</samp>, <samp>flower_item</samp>, <samp>food_bakery</samp>, <samp>food_breakfast</samp>, <samp>food_cake</samp>, <samp>food_party</samp>, <samp>food_pasta</samp>, <samp>food_salad</samp>, <samp>food_sauce</samp>, <samp>food_seafood</samp>, <samp>food_soup</samp>, <samp>food_spicy</samp>, <samp>food_sushi</samp>, <samp>food_sweet</samp>, <samp>forage_item</samp>, <samp>forage_item_beach</samp>, <samp>forage_item_cave</samp>, <samp>forage_item_desert</samp>, <samp>forage_item_mines</samp>, <samp>forage_item_secret</samp>, <samp>fossil_item</samp>, <samp>fruit_item</samp>, <samp>fruit_tree_item</samp>, <samp>furnace_item</samp>, <samp>ginger_item</samp>, <samp>goat_milk_item</samp>, <samp>golden_relic_item</samp>, <samp>honey_item</samp>, <samp>hunting_item</samp>, <samp>instrument_item</samp>, <samp>jelly_item</samp>, <samp>juice_item</samp>, <samp>large_egg_item</samp>, <samp>large_milk_item</samp>, <samp>light_source</samp>, <samp>machine_item</samp>, <samp>marine_item</samp>, <samp>mayo_item</samp>, <samp>medicine_item</samp>, <samp>milk_item</samp>, <samp>noble_item</samp>, <samp>ore_item</samp>, <samp>pickle_item</samp>, <samp>potion_item</samp>, <samp>prehistoric_item</samp>, <samp>quality_fertilizer_item</samp>, <samp>scroll_item</samp>, <samp>season_all</samp>, <samp>season_fall</samp>, <samp>season_spring</samp>, <samp>season_summer</samp>, <samp>season_winter</samp>, <samp>slime_egg_item</samp>, <samp>slime_item</samp>, <samp>statue_item</samp>, <samp>strange_doll_1</samp>, <samp>strange_doll_2</samp>, <samp>syrup_item</samp>, <samp>totem_item</samp>, <samp>toy_item</samp>, <samp>trash_item</samp>, <samp>tree_seed_item</samp>, <samp>wood_item</samp>.}}
 
==Objects==
Objects are the default type for items in inventories or placed in the world.
 
They have their data in <samp>Data/Objects</samp> (<samp>Data/ObjectInformation</samp> prior to 1.6), their icon sprites in <samp>Maps/springobjects</samp>, and their code in <samp>StardewValley.Object</samp>. See [[Modding:Items/Object sprites|a table of sprites and their corresponding indexes]].
 
===Data format===
The object data in <samp>Data/Objects</samp> consists of a string → model lookup, where...
The object data in <samp>Data/Objects</samp> consists of a string → model lookup, where...
* The key is the unqualified [[Modding:Common_data_field_types#Item_ID|item ID]].
* The key is the unqualified [[Modding:Common data field types#Item ID|item ID]].
* The value is a model with the fields listed below.
* The value is a model with the fields listed below.


====Basic info====
===Basic info===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 809: Line 26:
|-
|-
| <samp>Type</samp>
| <samp>Type</samp>
| The item's general type, like Arch (artifact) or Minerals. The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive  
| The item's general type, like Arch (artifact) or Minerals. The vanilla types are: <samp>Basic</samp>, <samp>Arch</samp> (artifact), <samp>Litter</samp> (e.g. debris), <samp>Minerals</samp>, <samp>Quest</samp>, <samp>Crafting</samp>, <samp>Fish</samp>, <samp>Cooking</samp>, <samp>Seeds</samp>, <samp>Ring</samp>, <samp>interactive</samp>, and some placeholder values like <samp>asdf</samp>.
 
'''Caution:''' adding custom items with the <samp>Arch</samp> type is inadvisable as it often leads to [[Artifact Spot|artifact spot]]s becoming broken and not giving any items.
 
'''Note:''' The "Type" affects whether an item shows up in the collections menu. For example, items with <samp>Type: Cooking</samp> will show up as silhouettes in the cooked items collection menu, items with <samp>Type: Minerals</samp> will show up as silhouettes in the mineral collection menu, etc. However, the [[Modding:Items#Categories|Category]] of the item must also be the correct number or the item will not count toward Perfection/Achievements. For example, if an item has Type: Cooking, it must also be "Category": -7 in order to count toward the "Gourmet Chef" achievement and Perfection.
|-
|-
| <samp>Category</samp>
| <samp>Category</samp>
Line 818: Line 39:
|}
|}


====Appearance====
===Appearance===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 829: Line 50:
| <samp>SpriteIndex</samp>
| <samp>SpriteIndex</samp>
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
|-
| <samp>ColorOverlayFromNextIndex</samp>
| ''(Optional)'' When drawn as a colored object, whether to apply the color to the next sprite in the spritesheet and draw that over the main sprite. If false, the color is applied to the main sprite instead. Default false.
|}
|}


====Edibility====
===Edibility===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 867: Line 91:
! result
! result
|-
|-
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>SpriteIndex</samp><br /><samp>GlowColor</samp>
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>IconSpriteIndex</samp><br /><samp>GlowColor</samp>
| If specified, the value in <samp>Data/Objects</samp> is used instead of the one in <samp>Data/Buffs</samp>. If omitted, defaults to the value from <samp>Data/Buffs</samp>.
| If specified, the value in <samp>Data/Objects</samp> is used instead of the one in <samp>Data/Buffs</samp>. If omitted, defaults to the value from <samp>Data/Buffs</samp>.
|-
|-
Line 883: Line 107:
| ''(Optional)'' The asset name for the icon texture to load. This must contain one or more 16x16 icons in a grid of any size. If omitted, the game will draw a default icon based on the <samp>BuffId</samp> and <samp>CustomAttributes</samp> fields.
| ''(Optional)'' The asset name for the icon texture to load. This must contain one or more 16x16 icons in a grid of any size. If omitted, the game will draw a default icon based on the <samp>BuffId</samp> and <samp>CustomAttributes</samp> fields.
|-
|-
| <samp>SpriteIndex</samp>
| <samp>IconSpriteIndex</samp>
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
|-
|-
| <samp>GlowColor</samp>
| <samp>GlowColor</samp>
| ''(Optional)'' The glow color to apply to the player. See [[Modding:Common_data_field_types#Color|color format]]. Default none.
| ''(Optional)'' The glow color to apply to the player. See [[Modding:Common data field types#Color|color format]]. Default none.
|-
|-
| <samp>CustomAttributes</samp>
| <samp>CustomAttributes</samp>
Line 898: Line 122:
! purpose
! purpose
|-
|-
| <samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| <samp>CombatLevel</samp><br /><samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| ''(Optional)'' An amount applied to the matching [[Skills|skill level]] while the buff is active. This can be negative for a debuff. Default 0.
| ''(Optional)'' An amount applied to the matching [[Skills|skill level]] while the buff is active. This can be negative for a debuff. Default 0.
|-
|-
| <samp>Attack</samp><br /><samp>Defense</samp><br /><samp>MagneticRadius</samp><br /><samp>MaxStamina</samp><br /><samp>Speed</samp>
| <samp>Attack</samp><br /><samp>AttackMultiplier</samp><br /><samp>CriticalChanceMultiplier</samp><br /><samp>CriticalPowerMultiplier</samp><br /><samp>Defense</samp><br /><samp>Immunity</samp><br /><samp>KnockbackMultiplier</samp><br /><samp>MagneticRadius</samp><br /><samp>MaxStamina</samp><br /><samp>Speed</samp><br /><samp>WeaponPrecisionMultiplier</samp><br /><samp>WeaponSpeedMultiplier</samp>
| ''(Optional)'' An amount applied to the player's [[attack]], [[defense]], [[Magnetism|magnetic radius]], maximum [[Energy|stamina]], or [[speed]] while the buff is active. This can be negative for a debuff. Default 0.
| ''(Optional)'' An amount applied to the player's [[attack]], [[Crit. Chance|critical chance]] and  [[Crit. Power|critical power]], [[defense]], [[immunity]], knockback (i.e. [[weight]]), [[Magnetism|magnetic radius]], maximum [[Energy|stamina]], [[speed]], or weapon precision/[[speed|speed]] while the buff is active. This can be negative for a debuff. Default 0.
|}
|}
|-
|-
| <samp>CustomFields</samp>
| <samp>CustomFields</samp>
| ''(Optional)'' The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.  
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.  
|}
|}
|}
|}


====Geodes & artifact spots====
===Geodes & artifact spots===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 943: Line 167:


For consistency, vanilla drops mostly use these values:
For consistency, vanilla drops mostly use these values:
* <samp>-1000</samp>: special overrides like the [[Golden Helmet]];
* <samp>-1000</samp>: special overrides like the [[Golden Helmet|golden helmet]];
* <samp>0</samp>: normal items.
* <samp>0</samp>: normal items.
|}</li>
|}</li>
Line 959: Line 183:
|}
|}


====Context tags & exclusions====
===Context tags & exclusions===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 966: Line 190:
|-
|-
| <samp>ContextTags</samp>
| <samp>ContextTags</samp>
| ''(Optional)'' The custom [[Modding:Items#Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
| ''(Optional)'' The custom [[Modding:Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
</syntaxhighlight>
</syntaxhighlight>
|-
| <samp>CanBeGivenAsGift</samp>
| ''(Optional)'' Whether this item can be gifted to NPCs. Default true.
|-
| <samp>CanBeTrashed</samp>
| ''(Optional)'' Whether this item can be trashed from the player's inventory. Also affects whether the item can be shipped but not whether it can be sold to shops. Default true.
|-
|-
| <samp>ExcludeFromRandomSale</samp>
| <samp>ExcludeFromRandomSale</samp>
Line 975: Line 205:
|-
|-
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
| ''(Optional)'' Whether to exclude this item from the fishing/shipping collection and their respective effect on the [[perfection|perfection score]]. Default false, in which case the normal requirements apply (e.g. artifacts are always excluded from the shipping collection).
| ''(Optional)'' Whether to exclude this item from the fishing/shipping collection and their respective effect on the [[perfection|perfection score]]. Default false, in which case the normal requirements apply (e.g., artifacts are always excluded from the shipping collection).
|}
|}


====Advanced====
===Advanced===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 985: Line 215:
|-
|-
| <samp>CustomFields</samp>
| <samp>CustomFields</samp>
| ''(Optional)'' The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.  
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.  
|}
|}


===Notes===
==Unobtainable items==
* Prior to 1.6, items that have a number in index 6 (the "Crafting" field) showed buggy information in-game (''e.g.,'' Bean Hotpot prior to version 1.4). Items that had a number in the "Attack" field displayed the Attack icon and a number, but no description. It's unclear how these buffs work (if at all).
The spritesheet and data have items that can't normally be found in the player inventory (like twigs and lumber), and some sprites have no corresponding item data. There are also multiple entries for ''weeds'' and ''stone'' corresponding to different sprites, but the player can only normally obtain one ''stone'' item (index 390) and no ''weeds'' items.
* '''Adding custom items with the <samp>Arch</samp> type is inadvisable as it often leads to Artifact Spots becoming broken and not giving any items.'''
* Named [[buffs]] (like [[Oil of Garlic]], [[Life Elixir]], or [[Buffs#Tipsy|Tipsy]]) are implemented in code and can't be set in the food buff fields.
* The spritesheet and data have items that can't normally be found in the player inventory (like twigs and lumber), and some sprites have no corresponding item data. There are also multiple entries for ''weeds'' and ''stone'' corresponding to different sprites, but the player can only normally obtain one ''stone'' item (index 390) and no ''weeds'' items.
 
==Big craftables==
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
 
They have their data in <samp>Data/BigCraftables</samp> (<samp>Data/BigCraftablesInformation</samp> prior to 1.6), their in-game sprites in <samp>TileSheets/Craftables</samp>, and their code in <samp>StardewValley.Object</samp> (with the <code>bigCraftable.Value = true</code> flag).


===Data format===
==For C# mods==
Object-type items are represented by the <samp>StardewValley.Object</samp> type.


This consists of a string → model lookup, where...
This provides many methods to simplify common logic. Some notable examples:
* The key is the unqualified [[Modding:Common_data_field_types#Item_ID|item ID]].
* The value is a model with the fields listed below.


====Basic info====
{| class="wikitable"
{| class="wikitable"
|-
|-
! field
! method
! purpose
|-
| <samp>Name</samp>
| The internal item name.
|-
| <samp>DisplayName</samp><br /><samp>Description</samp>
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
|-
| <samp>Price</samp>
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
|}
 
====Behavior====
{| class="wikitable"
|-
! field
! purpose
|-
| <samp>Fragility</samp>
| ''(Optional)'' How the item can be picked up. The possible values are 0 (pick up with any tool), 1 (destroyed if hit with an axe/hoe/pickaxe, or picked up with any other tool), or 2 (can't be removed once placed). Default 0.
|-
| <samp>CanBePlacedIndoors</samp><br /><samp>CanBePlacedOutdoors</samp>
| ''(Optional)'' Whether the item can be placed indoors or outdoors. Default true.
|-
| <samp>IsLamp</samp>
| ''(Optional)'' Whether this is a lamp and should produce light when dark. Default false.
|}
 
====Appearance====
{| class="wikitable"
|-
! field
! purpose
|-
| <samp>Texture</samp>
| ''(Optional)'' The asset name for the texture containing the item's sprite. Defaults to <samp>TileSheets/Craftables</samp>.
|-
| <samp>SpriteIndex</samp>
| ''(Optional)'' The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
|}
 
====Context tags====
{| class="wikitable"
|-
! field
! purpose
|-
| <samp>ContextTags</samp>
| ''(Optional)'' The custom [[Modding:Items#Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
<syntaxhighlight lang="json">
"ContextTags": [ "light_source", "torch_item" ]
</syntaxhighlight>
|}
 
====Advanced====
{| class="wikitable"
|-
! field
! purpose
|-
| <samp>CustomFields</samp>
| ''(Optional)'' The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.
|}
 
===Notes===
* Many of the items in the data asset aren't implemented in-game. They may be completely absent from the game, or they may be unused as craftables and instead appear in [[#Objects|object data]] or [[#Furniture|furniture data]].
 
==Boots==
Boots are items that can be equipped in the player's [[footwear]] slot.
 
They have their data in <samp>Data/Boots</samp>, their in-game sprites in <samp>Maps/springobjects</samp> (item sprite) and <samp>Characters/Farmer/shoeColors</samp> (shoe color), and their code in <samp>StardewValley.Objects.Boots</samp>.
 
===Data format===
The boots data in <samp>Data/Boots</samp> consists of an integer→string dictionary with entries like this:
 
<syntaxhighlight lang="json">
  "511": "Dark Boots/Made from thick black leather./250/4/2/7"
</syntaxhighlight>
 
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
 
{| class="wikitable"
|-
! index
! field
! effect
! effect
|-
|-
| 0
| <samp>Object.GetRadiusForScarecrow()</samp>
| name
| The tile radius that Object protects as a scarecrow. Default behavior: Checks for the value in the <samp>crow_scare_radius_{{t|radius}}</samp> [[Modding:Context tags|context tag]] if applicable, then defaults to 17 if the internal name contains "Deluxe" and 9 otherwise. Can be patched to support custom scarecrows.
| The internal item name (and display name in English).
|-
|-
| 1
| <samp>Object.IsBar()</samp>
| description
| Whether the item is a [[Copper Bar|copper bar]], [[Iron Bar|iron bar]], [[Gold Bar|gold bar]], [[Iridium Bar|iridium bar]], or [[Radioactive Bar|radioactive bar]].
| The translated item description shown in-game.
|-
|-
| 2
| <samp>Object.IsBreakableStone()</samp>
| price
| Whether the item is a stone debris item which can be broken by a pickaxe.
| '''Unused.''' The actual price is calculated as <samp>(''added defence'' × 100) + (''added immunity'' × 100)</samp>.
|-
|-
| 3
| <samp>Object.IsFence()</samp>
| added defense
| Whether the item is a [[Crafting#Fences|fence]].
| A [[defense]] bonus applied to the player while equipped.
|-
|-
| 4
| <samp>Object.IsFruitTreeSapling()</samp>
| added immunity
| Whether the item is a [[Fruit Trees|fruit tree]] sapling. This checks the <samp>Data\fruitTrees</samp> keys, so it works with custom fruit trees too.
| An [[immunity]] bonus applied to the player while equipped.
|-
|-
| 5
| <samp>Object.IsHeldOverHead()</samp>
| color index
| Whether the player is shown holding up the item when it's selected in their toolbar. Default true (except for furniture).
| The index of the boot color in the <samp>Characters/Farmer/shoeColors</samp> spritesheet.
|-
|-
| 6
| <samp>Object.IsIncubator()</samp>
| display name
| Whether the item can incubate [[Animals|farm animal]] eggs when placed in a building.
| The translated item name shown in-game (for non-English assets only).
|}
 
==Clothing==
Clothing consists of cosmetic items that can be equipped in the player's [[Tailoring|pants and shirt]] slots.
 
They have their data in <samp>Data/ClothingInformation</samp>, their in-game sprites in <samp>Characters/Farmer/pants</samp> & <samp>Characters/Farmer/shirts</samp>, and their code in <samp>StardewValley.Objects.Clothing</samp>.
 
===Data format===
The clothing data in <samp>Data/ClothingInformation</samp> consists of an integer→string dictionary with entries like this:
 
<syntaxhighlight lang="json">
  "1282": "Tomato Shirt/Tomato Shirt/A shirt that answers the big question: 'Tomatoes are'... (but the rest is smudged)./282/-1/50/255 0 0/false/Shirt/Sleeveless"
</syntaxhighlight>
 
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> (offset by 1000 for shirts) and the value is a slash-delimited string with these fields:
 
{| class="wikitable"
|-
|-
! index
| <samp>Object.IsScarecrow()</samp>
! field
| Whether the item is a scarecrow. Default: <samp>true</samp> if the object has the <samp>crow_scare</samp> [[Modding:Context_tags|context tag]]. Otherwise, returns whether the object's internal name contains "arecrow". Can be patched to support custom scarecrows.
! effect
|-
|-
| 0
| <samp>Object.IsTapper()</samp>
| name
| Whether the item is a [[Tapper|tapper]] or [[Heavy Tapper|heavy tapper]].
| The internal item name (and display name in English).
|-
|-
| 1
| <samp>Object.IsTeaSapling()</samp>
| display name
| Whether the item is a [[Tea Sapling|tea sapling]].
| The translated item name shown in-game.
|-
|-
| 2
| <samp>Object.IsTwig()</samp>
| description
| Whether the item is a twig debris item.
| The translated item description shown in-game.
|-
|-
| 3
| <samp>Object.IsWeeds()</samp>
| male index
| Whether the item is a weed debris item.
| The sprite index in the clothing spritesheet for male characters.
|-
| 4
| female index
| The sprite index in the clothing spritesheet for female characters, or <samp>-1</samp> to use the male index.
|-
| 5
| price
| The price when purchased from shops.
|-
| 6
| default color
| The default color, specified in space-delimited RGB with each channel being an integer from 0 (no color) to 255 (full color). For example, <samp>255 0 0</samp> for full red.
|-
| 7
| dyeable
| Whether the clothing can be [[Dyeing|dyed]] (<samp>true</samp> or <samp>false</samp>).
|-
| 8
| Type
| The clothing type. One of <samp>Pants</samp>, <samp>Shirt</samp>, or <s><samp>Accessory</samp></s> (unimplemented).
|-
| 9
| extra data
| A comma-delimited list of tags attached to the item (unrelated to [[#Context tags|context tags]]). The values recognized by the game are <samp>Prismatic</samp> (adds a shifting rainbow effect) and <samp>Sleeveless</samp> (disables drawing the sleeve color over the player's arms).
|}
|}
==Furniture==
Furniture are decorative items which can be placed in the world, including chairs which the player can sit on.
They have their data in <samp>Data/Furniture</samp>, their in-game sprites in <samp>TileSheets/furniture</samp>, and their code in <samp>StardewValley.Objects.Furniture</samp>.
===Data format===
The furniture data in <samp>Data/Furniture</samp> consists of an integer→string dictionary with entries like this:
<syntaxhighlight lang="json">
  "18": "Country Chair/chair/-1/-1/4/750"
</syntaxhighlight>
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
{| class="wikitable"
|-
! index
! field
! effect
|-
| 0
| name
| The internal item name (and display name in English).
|-
| 1
| type
| The furniture type. Possible values:
{| class="wikitable sortable"
|-
! type
! meaning
|-
| 0
| chair
|-
| 1
| bench
|-
| 2
| couch
|-
| 3
| armchair
|-
| 4
| dresser
|-
| 5
| long table
|-
| 6
| painting
|-
| 7
| lamp
|-
| 8
| decor
|-
| 9
| other
|-
| 10
| bookcase
|-
| 11
| table
|-
| 12
| rug
|-
| 13
| window
|-
| 14
| fireplace
|-
| 15
| bed
|-
| 16
| torch
|-
| 17
| sconce
|}
|-
| 2
| tilesheet size
| The furniture sprite size on the tilesheet, measured in tiles. This can be <samp>{{t|width}} {{t|height}}</samp> (e.g. <samp>1 2</samp>), or <samp>-1</samp> to use the default size for the type.
|-
| 3
| bounding box size
| The size of the hitbox when the furniture is placed in-game, measured in tiles. The bounding box will be anchored to the bottom-left corner and extend upwards and rightwards. This can be <samp>{{t|width}} {{t|height}}</samp> (e.g. <samp>1 2</samp>), or <samp>-1</samp> to use the default size for the type.
|-
| 4
| rotations
| The number of rotations possible (1, 2, or 4).
|-
| 5
| price
| The price when purchased from a shop.
|-
| 6
| placement restriction
| Where the furniture can be placed.
{| class="wikitable sortable"
|-
! value
! meaning
|-
| -1
| default (uses furniture type)
|-
| 0
| indoors-only
|-
| 1
| outdoors-only
|-
| 2
| indoors or outdoors
|}
|-
| 7
| display name
| The translated furniture name (in non-English data assets only).
|}
==Hats==
Hats are items that can be equipped in the player's [[hats|hat]] slot.
They have their data in <samp>Data/Hats</samp>, their in-game sprites in <samp>Characters/Farmer/hats</samp>, and their code in <samp>StardewValley.Objects.Hat</samp>.
===Data format===
The hat data in <samp>Data/Hats</samp> consists of an integer→string dictionary with entries like this:
<syntaxhighlight lang="json">
  "5": "Official Cap/Looks like it belonged to a postman or policeman. Either way, it's still very soft and smells okay./false/true"
</syntaxhighlight>
Hats from the base game use the hat's <samp>ParentSheetIndex</samp> as its item ID.
For each entry in the data asset, the key is the hat's item ID, and the value is a slash-delimited string with these fields:
{| class="wikitable"
|-
! index
! field
! effect
|-
| 0
| name
| The internal item name.
|-
| 1
| description
| The translated item description shown in-game.
|-
| 2
| show real hair
| Whether to show the player's hairstyle as-is when the hat is worn (<samp>true</samp>), or change the hairstyle to fit the hat (<samp>false</samp>).
|-
| 3
| skip hairstyle offset
| Whether to ignore the current style when positioning the hat (one of <samp>true</samp> or <samp>false</samp>). For example, the [[Eye Patch|eye patch]] sets <samp>true</samp> since its position isn't affected by the hair, but the [[Butterfly Bow|butterfly bow]] sets <samp>false</samp> to adjust its position on top of your hair.
|-
| 4
| tags
| A space-separated list of "tags". These are separate from context tags, and used to contain miscellaneous information. Currently, the only tag used by the game is <samp>Prismatic</samp>, which marks a hat as prismatic and causes it to cycle through colors.
|-
| 5
| display name
| The translated item name shown in-game.
|-
| 6
| sprite index
| The index in the hat spritesheet used to display this hat.
|-
| 7
| texture name
| The name of the game texture to use for the hat. If empty, the game will use the default hat sheet <samp>Characters/Farmer/hats</samp>
|}
Hats have a hard-coded category of -95 (<samp>HatDataDefinition.cs::GetData</samp>)
==Tools==
[[Tools]] are items that can be swung or used by the player to perform some effect (e.g. dig dirt, chop trees, etc).
They have their in-game sprites in <samp>TileSheets/Tools</samp>, and their code in <samp>StardewValley.Tool</samp> and various subclasses like <samp>StardewValley.Tools.Axe</samp>.
===Data format===
Tools are currently hardcoded and can't be edited by content packs.
==Weapons==
[[Weapons]] are tools that can be used by the player to damage monsters.
They have their data in <samp>Data/Weapons</samp>, their in-game sprites in <samp>TileSheets/weapons</samp>, and their code in <samp>StardewValley.Tools.MeleeWeapon</samp> and <samp>StardewValley.Tools.Slingshot</samp>.
===Data format===
The weapon data in <samp>Data/Weapons</samp> consists of an integer→string dictionary with entries like this:
<syntaxhighlight lang="json">
  "12": "Wooden Blade/Not bad for a piece of carved wood./3/7/1/0/0/0/0/3/-1/0/.02/3"
</syntaxhighlight>
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
; Melee weapons
: {| class="wikitable"
|-
! index
! field
! effect
|-
| 0
| name
| The internal weapon name (and display name in English).
|-
| 1
| description
| The translated item description shown in-game.
|-
| 2<br />3
| min damage<br />max damage
| The minimum and maximum damage caused when hitting a monster with this weapon.
|-
| 4
| knockback
| How far the target is pushed when hit, as a multiplier relative to a base weapon like the [[Rusty Sword]] (e.g. <samp>1.5</samp> for 150% of Rusty Sword's weight).
|-
| 5
| speed
| How fast the player can swing the weapon. Each point of speed is worth 40ms of swing time relative to 0. This stacks with the [[speed|player's weapon speed]].
|-
| 6
| added precision
| Reduces the chance that a strike will miss.
|-
| 7
| added defence
| Reduces damage received by the player.
|-
| 8
| type
| The weapon type. One of <samp>0</samp> (stabbing sword), <samp>1</samp> (dagger), <samp>2</samp> (club or hammer), or <samp>3</samp> (slashing sword).
|-
| 9<br />10
| base mine level<br />min mine level
| The base and minimum mine level, which affect [[#Mine container drops|mine container drops]].
|-
| 11
| added area of effect
| Slightly increases the area of effect.
|-
| 12
| critical chance
| The chance of a critical hit, as a decimal value between 0 and 1.
|-
| 13
| critical damage
| A multiplier applied to the damage for critical hit.
|-
| 14
| display name
| The translated item name (in non-English assets only).
|}
; Slingshots
: {| class="wikitable"
|-
! index
! field
! effect
|-
| 0
| name
| The internal weapon name (and display name in English).
|-
| 1
| description
| The translated item description shown in-game (for non-English assets only).
|-
| 2&ndash;8
| ''unused''
|
|-
| 9<br />10
| base mine level<br />min mine level
| The base and minimum mine level, which affect [[#Mine container drops|mine container drops]].
|-
| 11&ndash;13
| ''unused''
|
|-
| 14
| display name
| The translated item description shown in-game (for non-English assets only).
|}
Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>).
===Slingshot notes===
* The base [[slingshot]] has <samp>ParentSheetIndex</samp> 32 in the weapon data, which increases by one for each upgrade level (up to 34 in the weapon data, though only 32 and 33 are obtainable without mods).
* Slingshot damage is [[Slingshot#Ammunition|calculated dynamically]] regardless of the weapon data.
===Mine container drops===
When the player breaks a container in [[The Mines|the mines]], there's a chance it will drop a weapon. Here's how the weapon to drop is chosen<ref>See <samp>Utility.getUncommonItemForThisMineLevel</samp> in the game code.</ref>:
<ol>
<li>Match weapons whose minimum mine level ([[#Format|field 10]]) is less than the current mine level.</li>
<li>From that list, match weapons with a probability check based on the gap between the base mine level ([[#Format|field 9]]) and current mine level. The probability is a bell curve centered on the base mine level:
{| class="wikitable"
|-
! level difference
! probability
|-
| 0
| 100%
|-
| 5
| 92%
|-
| 10
| 71%
|-
| 15
| 46%
|-
| 20
| 25%
|-
| 25
| 4%
|}
The difference applies in both directions; for example, two weapons whose base levels are 5 below and 5 above the current level both have a 92% chance. (The probability is calculated with a [[wikipedia:Gaussian function|Gaussian function]] <code>e<sup>-(current mine level - base mine level)<sup>2</sup> / (2 * 12<sup>2</sup>)</sup></code>.)</li>
<li>Find the weapon with the smallest gap between the current and base mine levels, and add it to the list. (If the item was also selected in step 2, it has two chances to drop.)</li>
<li>From the remaining list of weapons, randomly choose one to drop.</li>
</ol>


==See also==
==See also==
* [[Modding:Index]] for related content like [[Modding:Crop data|crops]], [[Modding:Fish data|fish]], [[Modding:Gift taste data|gift tastes]], and [[Modding:Recipe data|recipes]]
* [[Modding:Items]] for item data in general
 
==References==
<references />


[[Category:Modding]]
[[Category:Modding]]


[[ru:Модификации:Объекты]]
[[ru:Модификации:Объекты]]
 
[[zh:模组:物体]]
==History==
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
{{History|1.6|Field 4 of hats is now used for tags, rather than displayName.}}
{{History|1.6|Display name field is now used for all languages.}}
{{History|1.6|Added Texture & texture index fields to all object data.}}
{{History|1.6|All types of items now use string IDs.}}

Latest revision as of 10:59, 8 August 2026

← Items

This page explains how the game stores and parses object-type item data. For items in general, see Modding:Items.

Overview

Objects are the default type for items in inventories or in the world. Depending on their data, they can be placed, picked up, eaten, sold to shops, etc.

They have item type (O) (or ItemRegistry.type_object in C# code), their data in Data/Objects, their icon sprites in Maps/springobjects or TileSheets/Objects_2 by default, and their code in StardewValley.Object. See a table of sprites and their corresponding indexes.

Data format

The object data in Data/Objects consists of a string → model lookup, where...

  • The key is the unqualified item ID.
  • The value is a model with the fields listed below.

Basic info

field purpose
Name The internal item name.
DisplayName
Description
A tokenizable string for the item's in-game display name and description.
Type The item's general type, like Arch (artifact) or Minerals. The vanilla types are: Basic, Arch (artifact), Litter (e.g. debris), Minerals, Quest, Crafting, Fish, Cooking, Seeds, Ring, interactive, and some placeholder values like asdf.

Caution: adding custom items with the Arch type is inadvisable as it often leads to artifact spots becoming broken and not giving any items.

Note: The "Type" affects whether an item shows up in the collections menu. For example, items with Type: Cooking will show up as silhouettes in the cooked items collection menu, items with Type: Minerals will show up as silhouettes in the mineral collection menu, etc. However, the Category of the item must also be the correct number or the item will not count toward Perfection/Achievements. For example, if an item has Type: Cooking, it must also be "Category": -7 in order to count toward the "Gourmet Chef" achievement and Perfection.

Category The item category.
Price (Optional) The price when sold by the player. This is not the price when bought from a shop. Default 0.

Appearance

field purpose
Texture The asset name for the texture containing the item's sprite. Defaults to Maps/springobjects.
SpriteIndex The sprite's index within the Texture, where 0 is the top-left sprite.
ColorOverlayFromNextIndex (Optional) When drawn as a colored object, whether to apply the color to the next sprite in the spritesheet and draw that over the main sprite. If false, the color is applied to the main sprite instead. Default false.

Edibility

field purpose
Edibility (Optional) A numeric value that determines how much energy (edibility × 2.5) and health (edibility × 1.125) is restored when this item is eaten. An item with an edibility of -300 can't be eaten, values from -299 to -1 reduce health and energy, and zero can be eaten but doesn't change health/energy. Default -300.
IsDrink (Optional) Whether to drink the item instead of eating it. Default false.
Buffs (Optional) The buffs to apply to the player when this item is eaten, if any. Default none.

This consists of a list of models with these fields:

field purpose
Id The unique string ID for this entry within the list.
Duration (Optional if BuffId is set) The buff duration measured in in-game minutes. This can be set to -2 for a buff that should last for the rest of the day.
BuffId (Optional) The unique ID of a buff from Data/Buffs to apply, or null to ignore Data/Buffs and set the ID to food or drink depending on the item's IsDrink field.

If a buff from Data/Buffs is applied and you also specify other fields, here's how the buff data is combined:

field result
Duration
IconTexture
IconSpriteIndex
GlowColor
If specified, the value in Data/Objects is used instead of the one in Data/Buffs. If omitted, defaults to the value from Data/Buffs.
CustomAttributes The values from both entries are combined (e.g. +1 speed in Data/Objects and +1 speed in Data/Buffs results in +2 speed).
IsDebuff The value in Data/Objects is used.
IsDebuff (Optional) Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
IconTexture (Optional) The asset name for the icon texture to load. This must contain one or more 16x16 icons in a grid of any size. If omitted, the game will draw a default icon based on the BuffId and CustomAttributes fields.
IconSpriteIndex (Optional) The buff's icon index within the IconTexture, where 0 is the top-left icon. Default 0.
GlowColor (Optional) The glow color to apply to the player. See color format. Default none.
CustomAttributes The custom buff attributes to apply, if any.

This consists of a model with any combination of these fields:

field purpose
CombatLevel
FarmingLevel
FishingLevel
ForagingLevel
LuckLevel
MiningLevel
(Optional) An amount applied to the matching skill level while the buff is active. This can be negative for a debuff. Default 0.
Attack
AttackMultiplier
CriticalChanceMultiplier
CriticalPowerMultiplier
Defense
Immunity
KnockbackMultiplier
MagneticRadius
MaxStamina
Speed
WeaponPrecisionMultiplier
WeaponSpeedMultiplier
(Optional) An amount applied to the player's attack, critical chance and critical power, defense, immunity, knockback (i.e. weight), magnetic radius, maximum stamina, speed, or weapon precision/speed while the buff is active. This can be negative for a debuff. Default 0.
CustomFields (Optional) The custom fields for this entry.

Geodes & artifact spots

field purpose
GeodeDrops
GeodeDropsDefaultItems
(Optional) The items that can be dropped when breaking open this item as a geode. Specifying either or both fields automatically enables geode behavior for this item.

You can specify one or both fields:

  • GeodeDrops can be set to the specific items to drop. Default none. This consists of a list of models with these fields:
    field purpose
    common fields See item spawn fields for the generic item fields supported by geode drops.

    If set to an item query which returns multiple items, one of them will be selected at random.

    Chance (Optional) The probability that the item will be dropped if the other fields match, as a decimal value between 0 (never) and 1 (always). Default 1.
    SetFlagOnPickup (Optional) The mail flag to set for the current player when this drop is picked up.
    Precedence (Optional) The order in which this entry should be checked, where lower values are checked first. This can be a negative value. Geode drops with the same precedence are checked in the order listed. Default 0.

    For consistency, vanilla drops mostly use these values:

    • -1000: special overrides like the golden helmet;
    • 0: normal items.
  • GeodeDropsDefaultItems chooses a predefined list of possible geode drops like clay, coal, copper, iridium, etc. Default false.

If both fields are specified, each geode will choose between them with an equal 50% chance. If GeodeDrops is specified but no entries match, the geode will use the GeodeDropsDefaultItems regardless of whether it's true.

ArtifactSpotChances (Optional) If this is an artifact (i.e. the Type field is Arch), the chance that it can be found by digging artifact spots in each location.

This consists of a string → model lookup, where:

  • the key is the internal location name;
  • the value is the probability the item will spawn if checked, as a decimal value between 0 (never) and 1 (always).

Context tags & exclusions

field purpose
ContextTags (Optional) The custom context tags to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
CanBeGivenAsGift (Optional) Whether this item can be gifted to NPCs. Default true.
CanBeTrashed (Optional) Whether this item can be trashed from the player's inventory. Also affects whether the item can be shipped but not whether it can be sold to shops. Default true.
ExcludeFromRandomSale (Optional) Whether to exclude this item from shops when selecting random items to sell. Default false.
ExcludeFromFishingCollection
ExcludeFromShippingCollection
(Optional) Whether to exclude this item from the fishing/shipping collection and their respective effect on the perfection score. Default false, in which case the normal requirements apply (e.g., artifacts are always excluded from the shipping collection).

Advanced

field purpose
CustomFields (Optional) The custom fields for this entry.

Unobtainable items

The spritesheet and data have items that can't normally be found in the player inventory (like twigs and lumber), and some sprites have no corresponding item data. There are also multiple entries for weeds and stone corresponding to different sprites, but the player can only normally obtain one stone item (index 390) and no weeds items.

For C# mods

Object-type items are represented by the StardewValley.Object type.

This provides many methods to simplify common logic. Some notable examples:

method effect
Object.GetRadiusForScarecrow() The tile radius that Object protects as a scarecrow. Default behavior: Checks for the value in the crow_scare_radius_<radius> context tag if applicable, then defaults to 17 if the internal name contains "Deluxe" and 9 otherwise. Can be patched to support custom scarecrows.
Object.IsBar() Whether the item is a copper bar, iron bar, gold bar, iridium bar, or radioactive bar.
Object.IsBreakableStone() Whether the item is a stone debris item which can be broken by a pickaxe.
Object.IsFence() Whether the item is a fence.
Object.IsFruitTreeSapling() Whether the item is a fruit tree sapling. This checks the Data\fruitTrees keys, so it works with custom fruit trees too.
Object.IsHeldOverHead() Whether the player is shown holding up the item when it's selected in their toolbar. Default true (except for furniture).
Object.IsIncubator() Whether the item can incubate farm animal eggs when placed in a building.
Object.IsScarecrow() Whether the item is a scarecrow. Default: true if the object has the crow_scare context tag. Otherwise, returns whether the object's internal name contains "arecrow". Can be patched to support custom scarecrows.
Object.IsTapper() Whether the item is a tapper or heavy tapper.
Object.IsTeaSapling() Whether the item is a tea sapling.
Object.IsTwig() Whether the item is a twig debris item.
Object.IsWeeds() Whether the item is a weed debris item.

See also