Changes

m
Line 42: Line 42:     
Each item has a <samp>ParentSheetIndex</samp> field which is its position in the item type's spritesheet, starting at 0 in the top-left and incrementing by one as you move across and then down. For example, hat #0 is the first sprite in <samp>Characters/Farmer/hats</samp>. The <samp>ParentSheetIndex</samp> is also used to identify the item itself; since spritesheet indexes aren't unique (''e.g.,'' there's both a hat #10 and object #10), code needs to check the type too like <code>item is Weapon weapon && weapon.ParentSheetIndex == 4</code>.
 
Each item has a <samp>ParentSheetIndex</samp> field which is its position in the item type's spritesheet, starting at 0 in the top-left and incrementing by one as you move across and then down. For example, hat #0 is the first sprite in <samp>Characters/Farmer/hats</samp>. The <samp>ParentSheetIndex</samp> is also used to identify the item itself; since spritesheet indexes aren't unique (''e.g.,'' there's both a hat #10 and object #10), code needs to check the type too like <code>item is Weapon weapon && weapon.ParentSheetIndex == 4</code>.
 +
 +
Flooring and wallpaper are not in any of these types and are not currently documented in this wiki.
    
See the sections below for details on each item type.
 
See the sections below for details on each item type.
Line 54: Line 56:     
==Common data==
 
==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===
 
===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>. Here are the valid categories:
Line 61: Line 89:  
! value
 
! value
 
! internal constant
 
! internal constant
 +
! [[#Context tags|context tag]]
 
! English translation
 
! English translation
 +
! Properties
 
|-
 
|-
 
| -2
 
| -2
 
| <samp>Object.GemCategory</samp>
 
| <samp>Object.GemCategory</samp>
 +
| <samp>category_gem</samp>
 
| Mineral
 
| Mineral
 +
| Affected by [[Skills#Mining|Gemologist]] profession
 
|-
 
|-
 
| -4
 
| -4
 
| <samp>Object.FishCategory</samp>
 
| <samp>Object.FishCategory</samp>
 +
| <samp>category_fish</samp>
 
| Fish
 
| Fish
 +
| Affected by [[Skills#Fishing|Fisher]] and [[Skills#Fishing|Angler]] professions
 
|-
 
|-
 
| -5
 
| -5
 
| <samp>Object.EggCategory</samp>
 
| <samp>Object.EggCategory</samp>
 +
| <samp>category_egg</samp>
 
| Animal Product
 
| Animal Product
 +
| Affected by [[Skills#Farming|Rancher]] profession, can be used in a slingshot
 
|-
 
|-
 
| -6
 
| -6
 
| <samp>Object.MilkCategory</samp>
 
| <samp>Object.MilkCategory</samp>
 +
| <samp>category_milk</samp>
 
| Animal Product
 
| Animal Product
 +
| Affected by [[Skills#Farming|Rancher]] profession
 
|-
 
|-
 
| -7
 
| -7
 
| <samp>Object.CookingCategory</samp>
 
| <samp>Object.CookingCategory</samp>
 +
| <samp>category_cooking</samp>
 
| Cooking
 
| Cooking
 +
|
 
|-
 
|-
 
| -8
 
| -8
 
| <samp>Object.CraftingCategory</samp>
 
| <samp>Object.CraftingCategory</samp>
 +
| <samp>category_crafting</samp>
 
| Crafting
 
| Crafting
 +
| Is Placeable
 
|-
 
|-
 
| -9
 
| -9
 
| <samp>Object.BigCraftableCategory</samp>
 
| <samp>Object.BigCraftableCategory</samp>
 +
| <samp>category_big_craftable</samp>
 
|  
 
|  
 +
| Is Placeable
 
|-
 
|-
 
| -12
 
| -12
 
| <samp>Object.mineralsCategory</samp>
 
| <samp>Object.mineralsCategory</samp>
 +
| <samp>category_minerals</samp>
 
| Mineral
 
| Mineral
 +
| Affected by [[Skills#Mining|Gemologist]] profession
 
|-
 
|-
 
| -14
 
| -14
 
| <samp>Object.meatCategory</samp>
 
| <samp>Object.meatCategory</samp>
 +
| <samp>category_meat</samp>
 
| Animal Product
 
| Animal Product
 +
|
 
|-
 
|-
 
| -15
 
| -15
 
| <samp>Object.metalResources</samp>
 
| <samp>Object.metalResources</samp>
 +
| <samp>category_metal_resources</samp>
 
| Resource
 
| Resource
 +
|
 
|-
 
|-
 
| -16
 
| -16
 
| <samp>Object.buildingResources</samp>
 
| <samp>Object.buildingResources</samp>
 +
| <samp>category_building_resources</samp>
 
| Resource
 
| Resource
 +
|
 
|-
 
|-
 
| -17
 
| -17
 
| <samp>Object.sellAtPierres</samp>
 
| <samp>Object.sellAtPierres</samp>
 +
| <samp>category_sell_at_pierres</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -18
 
| -18
 
| <samp>Object.sellAtPierresAndMarnies</samp>
 
| <samp>Object.sellAtPierresAndMarnies</samp>
 +
| <samp>category_sell_at_pierres_and_marnies</samp>
 
| Animal Product
 
| Animal Product
 +
| Affected by [[Skills#Farming|Rancher]] profession
 
|-
 
|-
 
| -19
 
| -19
 
| <samp>Object.fertilizerCategory</samp>
 
| <samp>Object.fertilizerCategory</samp>
 +
| <samp>category_fertilizer</samp>
 
| Fertilizer
 
| Fertilizer
 +
| Is Placeable, is always passable
 
|-
 
|-
 
| -20
 
| -20
 
| <samp>Object.junkCategory</samp>
 
| <samp>Object.junkCategory</samp>
 +
| <samp>category_junk</samp>
 
| Trash
 
| Trash
 +
|
 
|-
 
|-
 
| -21
 
| -21
 
| <samp>Object.baitCategory</samp>
 
| <samp>Object.baitCategory</samp>
 +
| <samp>category_bait</samp>
 
| Bait
 
| Bait
 +
| Can be attached to a fishing rod
 
|-
 
|-
 
| -22
 
| -22
 
| <samp>Object.tackleCategory</samp>
 
| <samp>Object.tackleCategory</samp>
 +
| <samp>category_tackle</samp>
 
| Fishing Tackle
 
| Fishing Tackle
 +
| Can be attached to a fishing rod, cannot stack
 
|-
 
|-
 
| -23
 
| -23
 
| <samp>sellAtFishShopCategory</samp>
 
| <samp>sellAtFishShopCategory</samp>
 +
| <samp>category_sell_at_fish_shop</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -24
 
| -24
 
| <samp>Object.furnitureCategory</samp>
 
| <samp>Object.furnitureCategory</samp>
 +
| <samp>category_furniture</samp>
 
| Decor
 
| Decor
 +
|
 
|-
 
|-
 
| -25
 
| -25
 
| <samp>Object.ingredientsCategory</samp>
 
| <samp>Object.ingredientsCategory</samp>
 +
| <samp>category_ingredients</samp>
 
| Cooking
 
| Cooking
 +
|
 
|-
 
|-
 
| -26
 
| -26
 
| <samp>Object.artisanGoodsCategory</samp>
 
| <samp>Object.artisanGoodsCategory</samp>
 +
| <samp>category_artisan_goods</samp>
 
| Artisan Goods
 
| Artisan Goods
 +
| Affected by [[Skills#Farming|Artisan]] profession
 
|-
 
|-
 
| -27
 
| -27
 
| <samp>Object.syrupCategory</samp>
 
| <samp>Object.syrupCategory</samp>
 +
| <samp>category_syrup</samp>
 
| Artisan Goods
 
| Artisan Goods
 +
| Affected by [[Skills#Foraging|Tapper]] profession
 
|-
 
|-
 
| -28
 
| -28
 
| <samp>Object.monsterLootCategory</samp>
 
| <samp>Object.monsterLootCategory</samp>
 +
| <samp>category_monster_loot</samp>
 
| Monster Loot
 
| Monster Loot
 +
|
 
|-
 
|-
 
| -29
 
| -29
 
| <samp>Object.equipmentCategory</samp>
 
| <samp>Object.equipmentCategory</samp>
 +
| <samp>category_equipment</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -74
 
| -74
 
| <samp>Object.SeedsCategory</samp>
 
| <samp>Object.SeedsCategory</samp>
 +
| <samp>category_seeds</samp>
 
| Seed
 
| Seed
 +
| Is Placeable, is always passable
 
|-
 
|-
 
| -75
 
| -75
 
| <samp>Object.VegetableCategory</samp>
 
| <samp>Object.VegetableCategory</samp>
 +
| <samp>category_vegetable</samp>
 
| Vegetable
 
| Vegetable
 +
| Affected by [[Skills#Farming|Tiller]] profession, can be used in a slingshot
 
|-
 
|-
 
| -79
 
| -79
 
| <samp>Object.FruitsCategory</samp>
 
| <samp>Object.FruitsCategory</samp>
 +
| <samp>category_fruits</samp>
 
| Fruit
 
| Fruit
 +
| Affected by [[Skills#Farming|Tiller]] profession (if not foraged), can be used in a slingshot
 
|-
 
|-
 
| -80
 
| -80
 
| <samp>Object.flowersCategory</samp>
 
| <samp>Object.flowersCategory</samp>
 +
| <samp>category_flowers</samp>
 
| Flower
 
| Flower
 +
| Affected by [[Skills#Farming|Tiller]] profession
 
|-
 
|-
 
| -81
 
| -81
 
| <samp>Object.GreensCategory</samp>
 
| <samp>Object.GreensCategory</samp>
 +
| <samp>category_greens</samp>
 
| Forage
 
| Forage
 +
|
 
|-
 
|-
 
| -95
 
| -95
 
| <samp>Object.hatCategory</samp>
 
| <samp>Object.hatCategory</samp>
 +
| <samp>category_hat</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -96
 
| -96
 
| <samp>Object.ringCategory</samp>
 
| <samp>Object.ringCategory</samp>
 +
| <samp>category_ring</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -98
 
| -98
 
| <samp>Object.weaponCategory</samp>
 
| <samp>Object.weaponCategory</samp>
 +
| <samp>category_weapon</samp>
 
|  
 
|  
 +
|
 
|-
 
|-
 
| -99
 
| -99
 
| <samp>Object.toolCategory</samp>
 
| <samp>Object.toolCategory</samp>
 +
| <samp>category_tool</samp>
 
|  
 
|  
 +
|
 
|}
 
|}
   Line 199: Line 295:  
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:
 
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.objectInformation.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>
+
<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===
 
===Context tags===
A ''context tag'' is an arbitrary label attached to items, which can produce various effects in-game.
+
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>):
   −
Every item has built-in tags for metadata like the item name, quality, and category. Further context tags are defined in <samp>Data/ObjectContextTags</samp>, which consists of a string→string dictionary (where the key is the item's internal name, and the value is a comma-delimited list of tags to add):
+
{| class="wikitable"
<syntaxhighlight lang="json">
+
|-
  "Chanterelle": "color_brown, forage_item, forage_item_cave, forage_item_secret, season_fall",
+
! context tag
</syntaxhighlight>
+
! 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:
   −
Context tags have a variety of effects in-game:
   
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! feature
+
! game data
 
! effects
 
! effects
 
|-
 
|-
| [[Fish Pond|fish ponds]]
+
| [[Modding:Fish Pond data|fish ponds]]
| Context tags determine what the fish will produce and other elements. See [[Modding:Fish Pond data#RequiredTags|Fish pond tags]] for more info.
+
| 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]]).
 
|-
 
|-
| [[Quests#List of Special Orders|special orders]]
+
| [[Modding:Special orders|special orders]]
| Contexts tags are used in special orders to determine what are the valid items for the quest objective(s).
+
| 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]]).
 
|-
 
|-
| [[Dyeing|dyeing]]
+
| tailoring
| Contexts tags are used to determine the color of dye an item produces.
+
| 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.
 
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==
 
Objects are the default type for items in inventories or placed in the world.
 
Objects are the default type for items in inventories or placed in the world.
   −
They have their data in <samp>Data/ObjectInformation</samp>, 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]].
+
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===
 
===Data format===
The object data in <samp>Data/ObjectInformation</samp> consists of an integer→string dictionary with entries like this:
+
The object data in <samp>Data/Objects</samp> consists of a string→ObjectData dictionary (where ObjectData is defined in the game code in <samp>GameData.Objects.ObjectData</samp>). It has entries like this<ref>See <samp>Data/Objects.xnb</ref>:
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
   "18": "Daffodil/30/0/Basic -81/Daffodil/A traditional spring flower that makes a nice gift."
+
"201": {
 +
  "Name": "Complete Breakfast",
 +
   "DisplayName": "[LocalizedText Strings\\Objects:CompleteBreakfast_Name]",
 +
  "Description": "[LocalizedText Strings\\Objects:CompleteBreakfast_Description]",
 +
  "Type": "Cooking",
 +
  "Category": -7,
 +
  "Price": 350,
 +
  "Texture": null,
 +
  "SpriteIndex": 201,
 +
  "Edibility": 80,
 +
  "IsDrink": false,
 +
  "Buffs": [
 +
    {
 +
      "Id": "Food",
 +
      "BuffId": null,
 +
      "IconTexture": null,
 +
      "IconSpriteIndex": 0,
 +
      "Duration": 600,
 +
      "IsDebuff": false,
 +
      "GlowColor": null,
 +
      "CustomAttributes": {
 +
        "FarmingLevel": 2.0,
 +
        "FishingLevel": 0.0,
 +
        "MiningLevel": 0.0,
 +
        "LuckLevel": 0.0,
 +
        "ForagingLevel": 0.0,
 +
        "MaxStamina": 50.0,
 +
        "MagneticRadius": 0.0,
 +
        "Speed": 0.0,
 +
        "Defense": 0.0,
 +
        "Attack": 0.0
 +
      },
 +
      "CustomFields": null
 +
    }
 +
  ],
 +
  "GeodeDropsDefaultItems": false,
 +
  "GeodeDrops": null,
 +
  "ArtifactSpotChances": null,
 +
  "ExcludeFromFishingCollection": false,
 +
  "ExcludeFromShippingCollection": false,
 +
  "ExcludeFromRandomSale": false,
 +
  "ContextTags": [
 +
    "color_yellow",
 +
    "food_breakfast"
 +
  ],
 +
  "CustomFields": null
 +
  }
 
</syntaxhighlight>
 
</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 the fields listed below. Fields 0–5 are used by rings and most other objects; fields 6–11 are only used for food buffs. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
+
For each entry in the data asset:
 +
* The key (before the colon) is the unqualified item ID and its sprite index within the [[Modding:Items/Object sprites|object spritesheet]] (saved as <samp>ParentSheetIndex</samp> in-code).
 +
* The value (after the colon) is the data pertaining to that object, with the fields listed below. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
    +
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
 +
 +
====Basic info====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! index
   
! field
 
! field
! effect
+
! 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>Type</samp>
 +
| The item's general type, like <samp>Arch</samp> (artifact) or <samp>Minerals</samp>.  The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive
 
|-
 
|-
!style="text-align: left;" colspan="3"| all objects
+
| <samp>Category</samp>
 +
| The [[Modding:Items#Categories|item category]].
 
|-
 
|-
| 0
+
| <samp>Price</samp>
| name
+
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| The internal item name (and display name in English).
+
|}
 +
 
 +
====Appearance====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 
|-
 
|-
| 1
+
| <samp>Texture</samp>
| price
+
| The asset name for the texture containing the item's sprite. Defaults to <samp>Maps/springobjects</samp>.
| The gold price of the item when sold by the player.
   
|-
 
|-
| 2
+
| <samp>SpriteIndex</samp>
| edibility
+
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| A numeric value that determines how much health (edibility × 2.5) and energy (edibility × 1.125) is restored. An item with an edibility of -300 can't be eaten.
+
|}
   −
This is ignored for rings.
+
====Edibility====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 
|-
 
|-
| 3
+
| <samp>Edibility</samp>
| type and category
+
| ''(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.
| &#32;
  −
* For a ring: the value <samp>Ring</samp>. Rings have a hardcoded category of -96 (<samp>Object.ringCategory</samp>).
  −
* For other objects: the item's type (string) and category (negative integer), separated by a space like <samp>Fish -4</samp>.
   
|-
 
|-
| 4
+
| <samp>IsDrink</samp>
| display name
+
| ''(Optional)'' Whether to drink the item instead of eating it. Default false.
| The translated item name.
   
|-
 
|-
| 5
+
| <samp>Buffs</samp>
| description
+
| ''(Optional)'' The buffs to apply to the player when this item is eaten, if any. Default none.
| The translated item description.
+
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 
|-
 
|-
!style="text-align: left;" colspan="3"| food & drink only
+
! field
 +
! purpose
 
|-
 
|-
| 6
+
| <samp>Id</samp>
| miscellaneous
+
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the list.
| &#32;
  −
* For a food or drink item, set this to <samp>food</samp> or <samp>drink</samp> respectively. This enables the remaining fields, and changes which animation/sound is played when the player consumes the item. Any other value is ignored.
  −
* For a geode item ([[Geode|535]], [[Frozen Geode|536]], [[Magma Geode|537]], or [[Omni Geode|749]]) is broken, a space-delimited list of object IDs. There's a roughly 50% chance that the geode item will drop one of these items (the other drops are hardcoded).
   
|-
 
|-
| 7
+
| <samp>Duration</samp>
| buffs
+
| ''(Optional if <samp>BuffId</samp> is set)'' The buff duration measured in in-game minutes. This can be set to <samp>-2</samp> for a buff that should last for the rest of the day.
| The bonuses to apply to the player's attribute when the item is consumed. This consists of a space-delimited list of these numbers:
  −
{|class="wikitable"
   
|-
 
|-
! index
+
| <samp>BuffId</samp>
! buff
+
| ''(Optional)'' The unique ID of a buff from [[#Custom buffs|<samp>Data/Buffs</samp>]] to apply, or <samp>null</samp> to ignore <samp>Data/Buffs</samp> and set the ID to <samp>food</samp> or <samp>drink</samp> depending on the item's <samp>IsDrink</samp> field.
 +
 
 +
If a buff from <samp>Data/Buffs</samp> is applied and you also specify other fields, here's how the buff data is combined:
 +
{| class="wikitable"
 
|-
 
|-
| 0
+
! field
| [[Skills#Farming|farming]]
+
! result
 
|-
 
|-
| 1
+
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>SpriteIndex</samp><br /><samp>GlowColor</samp>
| [[Skills#Fishing|fishing]]
+
| 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>.
 
|-
 
|-
| 2
+
| <samp>CustomAttributes</samp>
| [[Skills#Mining|mining]]
+
| The values from both entries are combined (e.g. +1 speed in <samp>Data/Objects</samp> and +1 speed in <samp>Data/Buffs</samp> results in +2 speed).
 
|-
 
|-
| 3
+
| <samp>IsDebuff</samp>
| ''unused''
+
| The value in <samp>Data/Objects</samp> is used.
 +
|}
 
|-
 
|-
| 4
+
| <samp>IsDebuff</samp>
| [[Luck|luck]]
+
| ''(Optional)'' Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
 
|-
 
|-
| 5
+
| <samp>IconTexture</samp>
| [[Skills#Foraging|foraging]]
+
| ''(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.
 
|-
 
|-
| 6
+
| <samp>SpriteIndex</samp>
| ''unused''
+
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
 
|-
 
|-
| 7
+
| <samp>GlowColor</samp>
| max [[energy]]
+
| ''(Optional)'' The glow color to apply to the player. See [[#Color fields|color format]]. Default none.
 
|-
 
|-
| 8
+
| <samp>CustomAttributes</samp>
| [[magnetism]]
+
| The custom buff attributes to apply, if any.
 +
 
 +
This consists of a model with any combination of these fields:
 +
{| class="wikitable"
 
|-
 
|-
| 9
+
! field
| [[speed]]
+
! purpose
 
|-
 
|-
| 10
+
| <samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| [[defense]]
+
| ''(Optional)'' An amount applied to the matching [[Skills|skill level]] while the buff is active. This can be negative for a debuff. Default 0.
 
|-
 
|-
| 11
+
| <samp>Attack</samp><br /><samp>Defense</samp><br /><samp>MagneticRadius</samp><br /><samp>MaxStamina</samp><br /><samp>Speed</samp>
| [[attack]]
+
| ''(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.
 
|}
 
|}
 
|-
 
|-
| 8
+
| <samp>CustomFields</samp>
| buff duration
+
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.  
| How long the buffs provided by the previous field last, measured in real seconds (assuming [[Day Cycle#Time speed|the default time speed]]). The buff duration number shown in-game will always be one second less than the calculated value.
+
|}
 
|}
 
|}
 +
    
===Notes===
 
===Notes===
* Items that have a number in the "Crafting" field show buggy information in-game (''e.g.,'' Bean Hotpot prior to version 1.4). Items that have a number in the "Attack" field display the Attack icon and a number, but no description. It's unclear how these buffs work (if at all).
+
* 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).
 +
* '''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.
 
* 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.
 
* 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.
Line 343: Line 624:  
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
 
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/BigCraftableInformation</samp>, 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).
+
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===
 
===Data format===
The big craftables data in <samp>Data/BigCraftableInformation</samp> consists of an integer→string dictionary with entries like this:
+
The big craftables data in <samp>Data/BigCraftables</samp> consists of a string → model lookup, where...
 +
* The key is the unqualified [[#Custom items|item ID]].
 +
* The value is a model with the fields listed below.
    
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
   "19": "Oil Maker/50/-300/Crafting -9/Makes gourmet truffle oil./true/true/0/Oil Maker"
+
   "19": {
 +
    "Name": "Oil Maker",
 +
    "DisplayName": "[LocalizedText Strings\\BigCraftables:OilMaker_Name]",
 +
    "Description": "[LocalizedText Strings\\BigCraftables:OilMaker_Description]",
 +
    "Price": 50,
 +
    "Fragility": 0,
 +
    "CanBePlacedOutdoors": true,
 +
    "CanBePlacedIndoors": true,
 +
    "IsLamp": false,
 +
    "Texture": null,
 +
    "SpriteIndex": 19,
 +
    "ContextTags": null,
 +
    "CustomFields": null
 +
  }
 
</syntaxhighlight>
 
</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:
+
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
    +
====Basic info====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! index
   
! field
 
! field
! effect
+
! purpose
 
|-
 
|-
| 0
+
| <samp>Name</samp>
| name
+
| The internal item name.
| The internal item name (and display name in English).
   
|-
 
|-
| 1
+
| <samp>DisplayName</samp><br /><samp>Description</samp>
| price
+
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
| The gold price when sold by the player.
   
|-
 
|-
| 2
+
| <samp>Price</samp>
| edibility
+
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| See edibility for [[#Objects|object data]]. Always set to <samp>-300</samp> (inedible) for vanilla items.
+
|}
 +
 
 +
====Behavior====
 +
{| class="wikitable"
 
|-
 
|-
| 3
+
! field
| type and category
+
! purpose
| See type and category for [[#Objects|object data]]. Always set to <samp>Crafting -9</samp> for vanilla items.
   
|-
 
|-
| 4
+
| <samp>Fragility</samp>
| description
+
| ''(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.
| The translated item description shown in-game.
   
|-
 
|-
| 5
+
| <samp>CanBePlacedIndoors</samp><br /><samp>CanBePlacedOutdoors</samp>
| outdoors
+
| ''(Optional)'' Whether the item can be placed indoors or outdoors. Default true.
| Whether the item can be placed outdoors (<samp>true</samp> or <samp>false</samp>).
   
|-
 
|-
| 6
+
| <samp>IsLamp</samp>
| indoors
+
| ''(Optional)'' Whether this is a lamp and should produce light when dark. Default false.
| Whether the item can be placed indoors (<samp>true</samp> or <samp>false</samp>).
+
|}
 +
 
 +
====Appearance====
 +
{| class="wikitable"
 
|-
 
|-
| 7
+
! field
| fragility
+
! purpose
| How the item is removed by tools. Possible values:
  −
{| class="wikitable"
   
|-
 
|-
! fragility
+
| <samp>Texture</samp>
! effect
+
| ''(Optional)'' The asset name for the texture containing the item's sprite. Defaults to <samp>TileSheets/Craftables</samp>.
 
|-
 
|-
| <samp>0</samp>
+
| <samp>SpriteIndex</samp>
| Pick up with any tool.
+
| ''(Optional)'' The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
 +
|}
 +
 
 +
====Context tags====
 +
{| class="wikitable"
 
|-
 
|-
| <samp>1</samp>
+
! field
| Destroyed if hit with an [[Axes|axe]], [[Hoes|hoe]], or [[Pickaxes|pickaxe]]. Any other tool will pick it up.
+
! purpose
 
|-
 
|-
| <samp>2</samp>
+
| <samp>ContextTags</samp>
| Indestructible. The item can't be removed once placed.
+
| ''(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"
 
|-
 
|-
| 8
+
! field
| is lamp
+
! purpose
| Whether the item is a lamp and produces light when it's dark. This can be <samp>true</samp> (mark as lamp) or any other value (ignored).
   
|-
 
|-
| 9
+
| <samp>CustomFields</samp>
| display name
+
| ''(Optional)'' The [[Modding:Migrate_to_Stardew_Valley_1.6#Custom_data_fields|custom fields]] for this entry.  
| The translated display name (in non-English assets only).
   
|}
 
|}
   Line 632: Line 935:  
|-
 
|-
 
| 6
 
| 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
 
| display name
 
| The translated furniture name (in non-English data assets only).
 
| The translated furniture name (in non-English data assets only).
Line 648: Line 972:  
</syntaxhighlight>
 
</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:
+
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"
 
{| class="wikitable"
Line 658: Line 983:  
| 0
 
| 0
 
| name
 
| name
| The internal item name (and display name in English).
+
| The internal item name.
 
|-
 
|-
 
| 1
 
| 1
Line 673: Line 998:  
|-
 
|-
 
| 4
 
| 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
 
| display name
| The translated item name shown in-game (for non-English assets only).
+
| 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>Hats.cs::Load</samp>)
+
Hats have a hard-coded category of -95 (<samp>HatDataDefinition.cs::GetData</samp>)
    
==Tools==
 
==Tools==
Line 842: Line 1,179:     
[[ru:Модификации:Объекты]]
 
[[ru:Модификации:Объекты]]
 +
 +
==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.}}
translators
8,437

edits