Jump to content

Modding:Objects: Difference between revisions

From Stardew Valley Wiki
imported>Pathoschild
→Objects: remove raw data (not scalable or maintainable), rework to include an example entry instead
imported>Zeltron0012
m removed a duplicate mention of CombatLevel in custom attributes
 
(190 intermediate revisions by 23 users not shown)
Line 1: Line 1:
← [[Modding:Index|Index]]
← [[Modding:Items|Items]]


This page explains how the game stores and parses object 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]].


==Objects==
==Overview==
Objects are the default type for items in inventories or placed in the world.
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 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:Object data/Sprites|a table of sprites and their corresponding indexes]].
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]].


===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 → model lookup, where...
<syntaxhighlight lang="json">
* The key is the unqualified [[Modding:Common data field types#Item ID|item ID]].
  "18": "Daffodil/30/0/Basic -81/Daffodil/A traditional spring flower that makes a nice gift."
* The value is a model with the fields listed below.
</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.


===Basic info===
{| class="wikitable"
{| class="wikitable"
|-
|-
! index
! field
! field
! effect
! purpose
|-
| <samp>Name</samp>
| The internal item name.
|-
|-
!style="text-align: left;" colspan="3"| all objects
| <samp>DisplayName</samp><br /><samp>Description</samp>
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
|-
|-
| 0
| <samp>Type</samp>
| name
| 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>.
| The internal item name (and display name in English).
 
'''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.  
|-
|-
| 1
| <samp>Category</samp>
| price
| The [[Modding:Items#Categories|item category]].
| The gold price of the item 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.
| 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.
===Appearance===
{| class="wikitable"
|-
|-
| 3
! field
| type and category
! purpose
| &#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>Texture</samp>
| display name
| The asset name for the texture containing the item's sprite. Defaults to <samp>Maps/springobjects</samp>.
| The translated item name.
|-
|-
| 5
| <samp>SpriteIndex</samp>
| description
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| The translated item description.
|-
|-
!style="text-align: left;" colspan="3"| food & drink only
| <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===
{| class="wikitable"
|-
|-
| 6
! field
| miscellaneous
! purpose
| &#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>Edibility</samp>
| buffs
| ''(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.
| 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>IsDrink</samp>
! buff
| ''(Optional)'' Whether to drink the item instead of eating it. Default false.
|-
|-
| 0
| <samp>Buffs</samp>
| [[Skills#Farming|farming]]
| ''(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:
{| class="wikitable"
|-
|-
| 1
! field
| [[Skills#Fishing|fishing]]
! purpose
|-
|-
| 2
| <samp>Id</samp>
| [[Skills#Mining|mining]]
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the list.
|-
|-
| 3
| <samp>Duration</samp>
| ''unused''
| ''(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.
|-
|-
| 4
| <samp>BuffId</samp>
| [[Luck|luck]]
| ''(Optional)'' The unique ID of a buff from <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"
|-
|-
| 5
! field
| [[Skills#Foraging|foraging]]
! result
|-
|-
| 6
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>IconSpriteIndex</samp><br /><samp>GlowColor</samp>
| ''unused''
| 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>.
|-
|-
| 7
| <samp>CustomAttributes</samp>
| max [[energy]]
| 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).
|-
| <samp>IsDebuff</samp>
| The value in <samp>Data/Objects</samp> is used.
|}
|-
|-
| 8
| <samp>IsDebuff</samp>
| [[magnetism]]
| ''(Optional)'' Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
|-
|-
| 9
| <samp>IconTexture</samp>
| [[speed]]
| ''(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.
|-
|-
| 10
| <samp>IconSpriteIndex</samp>
| [[defense]]
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
|-
|-
| 11
| <samp>GlowColor</samp>
| [[attack]]
| ''(Optional)'' The glow color to apply to the player. See [[Modding:Common data field types#Color|color format]]. Default none.
|}
|-
|-
| 8
| <samp>CustomAttributes</samp>
| buff duration
| The custom buff attributes to apply, if any.
| How long the buffs provided by the previous field last. This is converted into in-game minutes using the formula <samp>(''duration'' × 0.7) / 60</samp>. The buff duration number shown in-game will always be one second less than the calculated value.
|}


===Notes===
This consists of a model with any combination of these fields:
* 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).
{| class="wikitable"
* Named [[buffs]] (like [[Oil of Garlic]], [[Life Elixir]], or [[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.
 
==Categories==
Most items have a category, represented by a negative integer separate from the type name. 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
! field
! internal constant
! purpose
! English translation
|-
|-
| -2
| <samp>CombatLevel</samp><br /><samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| <samp>Object.GemCategory</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.
| Mineral
|-
|-
| -4
| <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>
| <samp>Object.FishCategory</samp>
| ''(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.
| Fish
|}
|-
|-
| -5
| <samp>CustomFields</samp>
| <samp>Object.EggCategory</samp>
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.
| Animal Product
|}
|}
 
===Geodes & artifact spots===
{| class="wikitable"
|-
|-
| -6
! field
| <samp>Object.MilkCategory</samp>
! purpose
| Animal Product
|-
|-
| -7
| <samp>GeodeDrops</samp><br /><samp><samp>GeodeDropsDefaultItems</samp>
| <samp>Object.CookingCategory</samp>
| ''(Optional)'' The items that can be dropped when breaking open this item as a [[Minerals#Geodes|geode]]. Specifying either or both fields automatically enables geode behavior for this item.
| Cooking
 
You can specify one or both fields:
<ul>
<li><samp>GeodeDrops</samp> can be set to the specific items to drop. Default none. This consists of a list of models with these fields:
{| class="wikitable"
|-
|-
| -8
! field
| <samp>Object.CraftingCategory</samp>
! purpose
| Crafting
|-
|-
| -9
| <samp>Object.BigCraftableCategory</samp>
|
|-
|-
| -12
| ''common fields''
| <samp>Object.mineralsCategory</samp>
| See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported by geode drops.
| Mineral
 
If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random.
|-
|-
| -14
| <samp>Chance</samp>
| <samp>Object.meatCategory</samp>
| ''(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.
| Animal Product
|-
|-
| -15
| <samp>SetFlagOnPickup</samp>
| <samp>Object.metalResources</samp>
| ''(Optional)'' The mail flag to set for the current player when this drop is picked up.
| Resource
|-
|-
| -16
| <samp>Precedence</samp>
| <samp>Object.buildingResources</samp>
| ''(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.
| Resource
 
For consistency, vanilla drops mostly use these values:
* <samp>-1000</samp>: special overrides like the [[Golden Helmet|golden helmet]];
* <samp>0</samp>: normal items.
|}</li>
<li><samp>GeodeDropsDefaultItems</samp> chooses a predefined list of possible geode drops like [[clay]], [[coal]], [[Copper Ore|copper]], [[Iridium Ore|iridium]], etc. Default false.</li>
</ul>
 
If both fields are specified, each geode will choose between them with an equal 50% chance. If <samp>GeodeDrops</samp> is specified but no entries match, the geode will use the <samp>GeodeDropsDefaultItems</samp> regardless of whether it's true.
|-
|-
| -17
| <samp>ArtifactSpotChances</samp>
| <samp>Object.sellAtPierres</samp>
| ''(Optional)'' If this is an artifact (i.e. the <samp>Type</samp> field is <samp>Arch</samp>), the chance that it can be found by digging [[Artifact Spot|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===
{| class="wikitable"
|-
|-
| -18
! field
| <samp>Object.sellAtPierresAndMarnies</samp>
! purpose
| Animal Product
|-
|-
| -19
| <samp>ContextTags</samp>
| <samp>Object.fertilizerCategory</samp>
| ''(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:
| Fertilizer
<syntaxhighlight lang="json">
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
</syntaxhighlight>
|-
|-
| -20
| <samp>CanBeGivenAsGift</samp>
| <samp>Object.junkCategory</samp>
| ''(Optional)'' Whether this item can be gifted to NPCs. Default true.
| Trash
|-
|-
| -21
| <samp>CanBeTrashed</samp>
| <samp>Object.baitCategory</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.
| Bait
|-
|-
| -22
| <samp>ExcludeFromRandomSale</samp>
| <samp>Object.tackleCategory</samp>
| ''(Optional)'' Whether to exclude this item from shops when selecting random items to sell. Default false.
| Fishing Tackle
|-
|-
| -23
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
| <samp>sellAtFishShopCategory</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).
|  
|}
 
===Advanced===
{| class="wikitable"
|-
|-
| -24
! field
| <samp>Object.furnitureCategory</samp>
! purpose
| Decor
|-
|-
| -25
| <samp>CustomFields</samp>
| <samp>Object.ingredientsCategory</samp>
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.
| Cooking
|}
 
==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 <samp>StardewValley.Object</samp> type.
 
This provides many methods to simplify common logic. Some notable examples:
 
{| class="wikitable"
|-
|-
| -26
! method
| <samp>Object.artisanGoodsCategory</samp>
! effect
| Artisan Goods
|-
|-
| -27
| <samp>Object.GetRadiusForScarecrow()</samp>
| <samp>Object.syrupCategory</samp>
| 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.
| Artisan Goods
|-
|-
| -28
| <samp>Object.IsBar()</samp>
| <samp>Object.monsterLootCategory</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]].
| Monster Loot
|-
|-
| -29
| <samp>Object.IsBreakableStone()</samp>
| <samp>Object.equipmentCategory</samp>
| Whether the item is a stone debris item which can be broken by a pickaxe.
|  
|-
|-
| -74
| <samp>Object.IsFence()</samp>
| <samp>Object.SeedsCategory</samp>
| Whether the item is a [[Crafting#Fences|fence]].
| Seed
|-
|-
| -75
| <samp>Object.IsFruitTreeSapling()</samp>
| <samp>Object.VegetableCategory</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.
| Vegetable
|-
|-
| -79
| <samp>Object.IsHeldOverHead()</samp>
| <samp>Object.FruitsCategory</samp>
| Whether the player is shown holding up the item when it's selected in their toolbar. Default true (except for furniture).
| Fruit
|-
|-
| -80
| <samp>Object.IsIncubator()</samp>
| <samp>Object.flowersCategory</samp>
| Whether the item can incubate [[Animals|farm animal]] eggs when placed in a building.
| Flower
|-
|-
| -81
| <samp>Object.IsScarecrow()</samp>
| <samp>Object.GreensCategory</samp>
| 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.
| Forage
|-
|-
| -95
| <samp>Object.IsTapper()</samp>
| <samp>Object.hatCategory</samp>
| Whether the item is a [[Tapper|tapper]] or [[Heavy Tapper|heavy tapper]].
|  
|-
|-
| -96
| <samp>Object.IsTeaSapling()</samp>
| <samp>Object.ringCategory</samp>
| Whether the item is a [[Tea Sapling|tea sapling]].
|  
|-
|-
| -98
| <samp>Object.IsTwig()</samp>
| <samp>Object.weaponCategory</samp>
| Whether the item is a twig debris item.
|  
|-
|-
| -99
| <samp>Object.IsWeeds()</samp>
| <samp>Object.toolCategory</samp>
| Whether the item is a weed debris item.
|  
|}
|}


Here's a dump of the vanilla items for each category as of {{version|1.4.3}}:
==See also==
{{collapse|Items with numeric categories|content=<syntaxhighlight lang="yaml">
* [[Modding:Items]] for item data in general
-81: Cave Carrot, Chanterelle, Common Mushroom, Daffodil, Dandelion, Hazelnut, Holly, Leek, Morel, Purple Mushroom, Red Mushroom, Sap, Snow Yam, Spring Onion, Wild Horseradish, Winter Root
-80: Blue Jazz, Crocus, Fairy Rose, Poppy, Summer Spangle, Sunflower, Sweet Pea, Tulip
-79: Ancient Fruit, Apple, Apricot, Blackberry, Blueberry, Cactus Fruit, Cherry, Coconut, Cranberries, Crystal Fruit, Grape, Hot Pepper, Melon, Orange, Peach, Pomegranate, Rhubarb, Salmonberry, Spice Berry, Starfruit, Strawberry, Wild Plum
-75: Amaranth, Artichoke, Beet, Bok Choy, Cauliflower, Corn, Eggplant, Fiddlehead Fern, Garlic, Green Bean, Hops, Kale, Parsnip, Potato, Pumpkin, Radish, Red Cabbage, Tea Leaves, Tomato, Unmilled Rice, Wheat, Yam
-74: Acorn, Amaranth Seeds, Ancient Seeds, Apple Sapling, Apricot Sapling, Artichoke Seeds, Bean Starter, Beet Seeds, Blueberry Seeds, Bok Choy Seeds, Cactus Seeds, Cauliflower Seeds, Cherry Sapling, Coffee Bean, Corn Seeds, Cranberry Seeds, Eggplant Seeds, Fairy Seeds, Fall Seeds, Garlic Seeds, Grape Starter, Hops Starter, Jazz Seeds, Kale Seeds, Maple Seed, Melon Seeds, Mixed Seeds, Orange Sapling, Parsnip Seeds, Peach Sapling, Pepper Seeds, Pine Cone, Pomegranate Sapling, Poppy Seeds, Potato Seeds, Pumpkin Seeds, Radish Seeds, Rare Seed, Red Cabbage Seeds, Rhubarb Seeds, Rice Shoot, Spangle Seeds, Spring Seeds, Starfruit Seeds, Strawberry Seeds, Summer Seeds, Sunflower Seeds, Tea Sapling, Tomato Seeds, Tulip Bulb, Wheat Seeds, Winter Seeds, Yam Seeds
-28: Bat Wing, Bug Meat, Slime, Solar Essence, Void Essence
-27: Maple Syrup, Oak Resin, Pine Tar
-26: Aged Roe, Beer, Caviar, Cheese, Cloth, Dinosaur Mayonnaise, Duck Mayonnaise, Goat Cheese, Green Tea, Honey, Jelly, Juice, Mayonnaise, Mead, Pale Ale, Pickles, Truffle Oil, Void Mayonnaise, Wine
-24: Brick Floor, Cobblestone Path, Crystal Floor, Crystal Path, Gravel Path, Stepping Stone Path, Stone Floor, Straw Floor, Tea Set, Weathered Floor, Wood Floor, Wood Path
-23: Clam, Coral, Nautilus Shell, Rainbow Shell, Roe, Sea Urchin, Squid Ink
-22: Barbed Hook, Cork Bobber, Dressed Spinner, Lead Bobber, Spinner, Trap Bobber, Treasure Hunter
-21: Bait, Magnet, Wild Bait
-20: Broken CD, Broken Glasses, Driftwood, Joja Cola, Rotten Plant, Rotten Plant, Soggy Newspaper, Trash
-19: Basic Fertilizer, Basic Retaining Soil, Deluxe Speed-Gro, Quality Fertilizer, Quality Retaining Soil, Speed-Gro, Tree Fertilizer
-18: Duck Feather, Rabbit's Foot, Wool
-17: Sweet Gem Berry, Truffle
-16: Battery Pack, Clay, Fiber, Hardwood, Stone, Wood
-15: Coal, Copper Bar, Copper Ore, Gold Bar, Gold Ore, Iridium Bar, Iridium Ore, Iron Bar, Iron Ore, Refined Quartz
-12: Aerinite, Alamite, Baryte, Basalt, Bixite, Calcite, Celestine, Dolomite, Esperite, Fairy Stone, Fire Opal, Fluorapatite, Geminite, Ghost Crystal, Granite, Helvite, Hematite, Jagoite, Jamborite, Jasper, Kyanite, Lemon Stone, Limestone, Lunarite, Malachite, Marble, Mudstone, Nekoite, Neptunite, Obsidian, Ocean Stone, Opal, Orpiment, Petrified Slime, Pyrite, Sandstone, Slate, Soapstone, Star Shards, Thunder Egg, Tigerseye
-8: Bomb, Cherry Bomb, Dwarvish Translation Guide, Gate, Hardwood Fence, Iridium Sprinkler, Iron Fence, Jack-O-Lantern, Mega Bomb, Quality Sprinkler, Sprinkler, Stone Fence, Wood Fence
-7: Algae Soup, Artichoke Dip, Autumn's Bounty, Baked Fish, Bean Hotpot, Blackberry Cobbler, Blueberry Tart, Bread, Bruschetta, Carp Surprise, Cheese Cauliflower, Chocolate Cake, Chowder, Coleslaw, Complete Breakfast, Cookie, Crab Cakes, Cranberry Candy, Cranberry Sauce, Crispy Bass, Dish O' The Sea, Eggplant Parmesan, Escargot, Farmer's Lunch, Fiddlehead Risotto, Fish Stew, Fish Taco, Fried Calamari, Fried Eel, Fried Egg, Fried Mushroom, Fruit Salad, Glazed Yams, Hashbrowns, Ice Cream, Life Elixir, Lobster Bisque, Lucky Lunch, Magic Rock Candy, Maki Roll, Maple Bar, Miner's Treat, Oil of Garlic, Omelet, Pale Broth, Pancakes, Parsnip Soup, Pepper Poppers, Pink Cake, Pizza, Plum Pudding, Poppyseed Muffin, Pumpkin Pie, Pumpkin Soup, Radish Salad, Red Plate, Rhubarb Pie, Rice Pudding, Roasted Hazelnuts, Roots Platter, Salad, Salmon Dinner, Sashimi, Seafoam Pudding, Shrimp Cocktail, Spaghetti, Spicy Eel, Stir Fry, Strange Bun, Stuffing, Super Meal, Survival Burger, Tom Kha Soup, Tortilla, Triple Shot Espresso, Trout Soup, Vegetable Medley
-6: Goat Milk, L. Goat Milk, Large Milk, Milk
-5: Duck Egg, Egg, Egg, Large Egg, Large Egg, Void Egg
-4: Albacore, Anchovy, Angler, Blobfish, Bream, Bullhead, Carp, Catfish, Chub, Cockle, Crab, Crayfish, Crimsonfish, Dorado, Eel, Flounder, Ghostfish, Glacierfish, Halibut, Herring, Ice Pip, Largemouth Bass, Lava Eel, Legend, Lingcod, Lobster, Midnight Carp, Midnight Squid, Mussel, Mutant Carp, Octopus, Oyster, Perch, Periwinkle, Pike, Pufferfish, Rainbow Trout, Red Mullet, Red Snapper, Salmon, Sandfish, Sardine, Scorpion Carp, Sea Cucumber, Shad, Shrimp, Slimejack, Smallmouth Bass, Snail, Spook Fish, Squid, Stonefish, Sturgeon, Sunfish, Super Cucumber, Tiger Trout, Tilapia, Tuna, Void Salmon, Walleye, Woodskip
-2: Amethyst, Aquamarine, Diamond, Earth Crystal, Emerald, Fire Quartz, Frozen Tear, Jade, Prismatic Shard, Quartz, Ruby, Topaz
</syntaxhighlight>}}


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


[[ru:Модификации:Объекты]]
[[ru:Модификации:Объекты]]
[[zh:模组:物体]]

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