Jump to content

Modding:Objects: Difference between revisions

From Stardew Valley Wiki
imported>Pathoschild
merge Modding:Weapon data into page as-is (main content author: Pathoschild, initial melee weapon field list by Minervamaga, improved melee weapon field descriptions by SentryTV, raw data updated by Metalax)
imported>Zeltron0012
m removed a duplicate mention of CombatLevel in custom attributes
 
(176 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 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==
===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.
Items are divided into several types:


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==
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 value is a model with the fields listed below.
===Basic info===
{| class="wikitable"
{| class="wikitable"
|-
|-
! item type
! field
! data asset
! purpose
! texture name
! summary
|-
|-
| <samp>Object</samp>
| <samp>Name</samp>
| <samp>Data/ObjectInformation</samp>
| The internal item name.
| <samp>Maps/springobjects</samp>
| The default type for items in inventories or placed in the world.
|-
|-
| <samp>Object</samp> (big craftable)
| <samp>DisplayName</samp><br /><samp>Description</samp>
| <samp>Data/BigCraftablesInformation</samp>
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
| <samp>TileSheets/Craftables</samp>
| Craftable items which can be placed in the world and are two tiles tall (instead of one like objects).
|-
|-
| <Samp>Boots</samp>
| <samp>Type</samp>
| <samp>Data/Boots</samp>
| 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>.
| item sprite: <samp>Maps/springobjects</samp><br />shoe color: <samp>Characters/Farmer/shoeColors</samp>
 
| Equippable boots.
'''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>Clothing</samp>
| <samp>Category</samp>
| <samp>Data/ClothingInformation</samp>
| The [[Modding:Items#Categories|item category]].
| <samp>Characters/Farmer/pants</samp><br /><samp>Characters/Farmer/shirts</samp>
| Equippable pants and shirts.
|-
|-
| <samp>Furniture</samp>
| <samp>Price</samp>
| <samp>Data/Furniture</samp>
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| <samp>TileSheets/furniture</samp>
| Decorative furniture items, including chairs which the player can sit on.
|-
| <samp>Hat</samp>
| <samp>Data/Hats</samp>
| <samp>Characters/Farmer/hats</samp>
| Equippable hat items.
|-
| <samp>Tool</samp>
| &mdash;
| <samp>TileSheets/Tools</samp>
| Tools that can be used by the player.
|-
| <samp>MeleeWeapon</samp>
| <samp>Data/Weapons</samp>
| <samp>TileSheets/weapons</samp>
| Weapons that can be used by the player to damage monsters.
|}
|}


The game has two files in its <samp>Content</samp> folder (which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]) for each item type:
===Appearance===
* a ''data asset'' for the text data for its items (names, descriptions, prices, etc);
{| class="wikitable"
* 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>.
 
See the sections below for details on each item type.
 
===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
! field
! internal constant
! purpose
! English translation
|-
| -2
| <samp>Object.GemCategory</samp>
| Mineral
|-
| -4
| <samp>Object.FishCategory</samp>
| Fish
|-
| -5
| <samp>Object.EggCategory</samp>
| Animal Product
|-
| -6
| <samp>Object.MilkCategory</samp>
| Animal Product
|-
| -7
| <samp>Object.CookingCategory</samp>
| Cooking
|-
| -8
| <samp>Object.CraftingCategory</samp>
| Crafting
|-
| -9
| <samp>Object.BigCraftableCategory</samp>
|
|-
| -12
| <samp>Object.mineralsCategory</samp>
| Mineral
|-
| -14
| <samp>Object.meatCategory</samp>
| Animal Product
|-
| -15
| <samp>Object.metalResources</samp>
| Resource
|-
| -16
| <samp>Object.buildingResources</samp>
| Resource
|-
| -17
| <samp>Object.sellAtPierres</samp>
|
|-
| -18
| <samp>Object.sellAtPierresAndMarnies</samp>
| Animal Product
|-
| -19
| <samp>Object.fertilizerCategory</samp>
| Fertilizer
|-
| -20
| <samp>Object.junkCategory</samp>
| Trash
|-
| -21
| <samp>Object.baitCategory</samp>
| Bait
|-
| -22
| <samp>Object.tackleCategory</samp>
| Fishing Tackle
|-
| -23
| <samp>sellAtFishShopCategory</samp>
|
|-
| -24
| <samp>Object.furnitureCategory</samp>
| Decor
|-
| -25
| <samp>Object.ingredientsCategory</samp>
| Cooking
|-
| -26
| <samp>Object.artisanGoodsCategory</samp>
| Artisan Goods
|-
| -27
| <samp>Object.syrupCategory</samp>
| Artisan Goods
|-
| -28
| <samp>Object.monsterLootCategory</samp>
| Monster Loot
|-
| -29
| <samp>Object.equipmentCategory</samp>
|
|-
| -74
| <samp>Object.SeedsCategory</samp>
| Seed
|-
| -75
| <samp>Object.VegetableCategory</samp>
| Vegetable
|-
| -79
| <samp>Object.FruitsCategory</samp>
| Fruit
|-
| -80
| <samp>Object.flowersCategory</samp>
| Flower
|-
| -81
| <samp>Object.GreensCategory</samp>
| Forage
|-
| -95
| <samp>Object.hatCategory</samp>
|
|-
|-
| -96
| <samp>Texture</samp>
| <samp>Object.ringCategory</samp>
| The asset name for the texture containing the item's sprite. Defaults to <samp>Maps/springobjects</samp>.
|
|-
|-
| -98
| <samp>SpriteIndex</samp>
| <samp>Object.weaponCategory</samp>
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
|
|-
|-
| -99
| <samp>ColorOverlayFromNextIndex</samp>
| <samp>Object.toolCategory</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.
|  
|}
|}


{{collapse|Console commands|content=
===Edibility===
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>
}}
 
===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===
Every item must be assigned a unique <samp>ParentSheetIndex</samp> within its type, and that index must fit within the item type's spritesheet.
 
Adding custom items to the data assets and spritesheets directly is '''not recommended''', since it's very easy to conflict with other mods or cause game errors. Instead you should create a content pack for {{nexus mod|1720|Json Assets}}, which coordinates dynamic item ID assignment so multiple custom item mods can work together.
 
==Objects==
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]].
 
===Data format===
The object data in <samp>Data/ObjectInformation</samp> consists of an integer→string dictionary with entries like this:
<syntaxhighlight lang="json">
  "18": "Daffodil/30/0/Basic -81/Daffodil/A traditional spring flower that makes a nice gift."
</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.
 
{| class="wikitable"
{| class="wikitable"
|-
|-
! index
! field
! field
! effect
! purpose
|-
!style="text-align: left;" colspan="3"| all objects
|-
|-
| 0
| <samp>Edibility</samp>
| name
| ''(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 internal item name (and display name in English).
|-
|-
| 1
| <samp>IsDrink</samp>
| price
| ''(Optional)'' Whether to drink the item instead of eating it. Default false.
| The gold price of the item when sold by the player.
|-
|-
| 2
| <samp>Buffs</samp>
| edibility
| ''(Optional)'' The buffs to apply to the player when this item is eaten, if any. Default none.
| 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.
This consists of a list of models with these fields:
{| 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>Id</samp>
| display name
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the list.
| The translated item name.
|-
|-
| 5
| <samp>Duration</samp>
| description
| ''(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 translated item description.
|-
|-
!style="text-align: left;" colspan="3"| food & drink only
| <samp>BuffId</samp>
|-
| ''(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.
| 6
| miscellaneous
| &#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
| buffs
| 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
! buff
|-
| 0
| [[Skills#Farming|farming]]
|-
| 1
| [[Skills#Fishing|fishing]]
|-
| 2
| [[Skills#Mining|mining]]
|-
| 3
| ''unused''
|-
| 4
| [[Luck|luck]]
|-
| 5
| [[Skills#Foraging|foraging]]
|-
| 6
| ''unused''
|-
| 7
| max [[energy]]
|-
| 8
| [[magnetism]]
|-
| 9
| [[speed]]
|-
| 10
| [[defense]]
|-
| 11
| [[attack]]
|}
|-
| 8
| buff duration
| 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===
* 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).
* 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.
 
==Objects (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/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).
 
===Data format===
The big craftables data in <samp>Data/BigCraftableInformation</samp> consists of an integer→string dictionary with entries like this:
 
<syntaxhighlight lang="json">
  "19": "Oil Maker/50/-300/Crafting -9/Makes gourmet truffle oil./true/true/0/Oil Maker"
</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:


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"
{| class="wikitable"
|-
|-
! index
! field
! field
! effect
! result
|-
|-
| 0
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>IconSpriteIndex</samp><br /><samp>GlowColor</samp>
| name
| 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>.
| The internal item name (and display name in English).
|-
|-
| 1
| <samp>CustomAttributes</samp>
| price
| 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).
| The gold price when sold by the player.
|-
|-
| 2
| <samp>IsDebuff</samp>
| edibility
| The value in <samp>Data/Objects</samp> is used.
| See edibility for [[#Objects|object data]]. Always set to <samp>-300</samp> (inedible) for vanilla items.
|}
|-
|-
| 3
| <samp>IsDebuff</samp>
| type and category
| ''(Optional)'' Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
| See type and category for [[#Objects|object data]]. Always set to <samp>Crafting -9</samp> for vanilla items.
|-
|-
| 4
| <samp>IconTexture</samp>
| description
| ''(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.
| The translated item description shown in-game.
|-
|-
| 5
| <samp>IconSpriteIndex</samp>
| outdoors
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
| Whether the item can be placed outdoors (<samp>true</samp> or <samp>false</samp>).
|-
|-
| 6
| <samp>GlowColor</samp>
| indoors
| ''(Optional)'' The glow color to apply to the player. See [[Modding:Common data field types#Color|color format]]. Default none.
| Whether the item can be placed indoors (<samp>true</samp> or <samp>false</samp>).
|-
|-
| 7
| <samp>CustomAttributes</samp>
| fragility
| The custom buff attributes to apply, if any.
| How the item is removed by tools. Possible values:
 
This consists of a model with any combination of these fields:
{| class="wikitable"
{| class="wikitable"
|-
|-
! fragility
! field
! effect
! purpose
|-
|-
| <samp>0</samp>
| <samp>CombatLevel</samp><br /><samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| Pick up with any tool.
| ''(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>1</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>
| Destroyed if hit with an [[axe]], [[hoe]], or [[pickaxe]]. Any other tool will pick it up.
| ''(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>2</samp>
| <samp>CustomFields</samp>
| Indestructible. The item can't be removed once placed.
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.  
|}
|}
|-
| 8
| is lamp
| 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
| display name
| The translated display name (in non-English assets only).
|}
|}


===Notes===
===Geodes & artifact spots===
* 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]].
 
==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"
{| class="wikitable"
|-
|-
! index
! field
! field
! effect
! purpose
|-
|-
| 0
| <samp>GeodeDrops</samp><br /><samp><samp>GeodeDropsDefaultItems</samp>
| name
| ''(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.
| The internal item name (and display name in English).
 
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"
|-
|-
| 1
! field
| type
! purpose
| The furniture type. Possible values:
{| class="wikitable sortable"
|-
|-
! type
! meaning
|-
|-
| 0
| ''common fields''
| chair
| See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported by geode drops.
|-
 
| 1
If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random.
| 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
| <samp>Chance</samp>
| fireplace
| ''(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.
|-
|-
| 15
| <samp>SetFlagOnPickup</samp>
| bed
| ''(Optional)'' The mail flag to set for the current player when this drop is picked up.
|-
|-
| 16
| <samp>Precedence</samp>
| torch
| ''(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.
|-
| 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
| display name
| The translated furniture name (in non-English data assets only).
|}


==Hats==
For consistency, vanilla drops mostly use these values:
Hats are items that can be equipped in the player's [[hats|hat]] slot.
* <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>


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>.
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.
|-
| <samp>ArtifactSpotChances</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.


===Data format===
This consists of a string → model lookup, where:
The hat data in <samp>Data/Hats</samp> consists of an integer→string dictionary with entries like this:
* 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).
<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>
 
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:


===Context tags & exclusions===
{| class="wikitable"
{| class="wikitable"
|-
|-
! index
! field
! field
! effect
! purpose
|-
|-
| 0
| <samp>ContextTags</samp>
| name
| ''(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:
| The internal item name (and display name in English).
<syntaxhighlight lang="json">
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
</syntaxhighlight>
|-
|-
| 1
| <samp>CanBeGivenAsGift</samp>
| description
| ''(Optional)'' Whether this item can be gifted to NPCs. Default true.
| The translated item description shown in-game.
|-
|-
| 2
| <samp>CanBeTrashed</samp>
| show real hair
| ''(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.
| 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
| <samp>ExcludeFromRandomSale</samp>
| skip hairstyle offset
| ''(Optional)'' Whether to exclude this item from shops when selecting random items to sell. Default false.
| 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
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
| display name
| ''(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).
| The translated item name shown in-game (for non-English assets only).
|}
|}


Hats have a hard-coded category of -95 (<samp>Hats.cs::Load</samp>)
===Advanced===
 
=Weapons=
This page explains how the game stores and parses weapon data. This is an advanced guide for mod developers.
 
==Raw data==
Weapon sprites are in <samp>TileSheets\Weapons.xnb</samp>, and weapon data (parsed by the <samp>MeleeWeapon</samp> constructor) is in <samp>Data\Weapons.xnb</samp>. The files can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data as of {{version|1.5.1}} for reference:
 
{{collapse|Data|content=<syntaxhighlight lang="json">
{
  "0": "Rusty Sword/A rusty, dull old sword./2/5/1/0/0/0/3/-1/-1/0/.02/3",
  "1": "Silver Saber/Plated with silver to deter rust./8/15/1/0/1/1/0/50/45/0/.02/3",
  "2": "Dark Sword/It's glowing with vampire energy./30/45/1.5/-10/0/0/0/-1/-1/2/.04/3",
  "3": "Holy Blade/It feels hopeful to wield./18/24/1.2/0/5/0/3/-1/-1/0/.02/3",
  "4": "Galaxy Sword/It's unlike anything you've ever seen./60/80/1/8/0/0/0/-1/-1/0/.02/3",
  "5": "Bone Sword/A very light piece of sharpened bone./20/30/.8/8/5/0/0/74/50/0/.02/3",
  "6": "Iron Edge/A heavy broadsword./12/25/1.2/-4/0/1/3/44/-1/0/.02/3",
  "7": "Templar's Blade/It once belonged to an honorable knight./22/29/1/0/10/1/3/90/50/0/0/3",
  "8": "Obsidian Edge/It's incredibly sharp./30/45/1/-2/0/0/0/121/100/0/.02/3.2",
  "9": "Lava Katana/A powerful blade forged in a pool of churning lava./55/64/1.2/0/0/3/0/-1/-1/2/.015/3.5",
  "10": "Claymore/It's really heavy./20/32/1.3/-8/0/2/3/86/50/0/.02/3",
  "11": "Steel Smallsword/A standard metal blade./4/8/1/4/0/0/0/26/-1/0/.02/3",
  "12": "Wooden Blade/Not bad for a piece of carved wood./3/7/1/0/0/0/0/3/-1/0/.02/3",
  "13": "Insect Head/Not very pleasant to wield./10/20/1/4/9/0/0/-1/-1/0/.04/3",
  "14": "Neptune's Glaive/An heirloom from beyond the Gem Sea./18/35/1.4/-2/6/2/3/-1/-1/0/.02/3",
  "15": "Forest Sword/Made powerful by forest magic./8/18/1/4/5/1/0/-1/-1/0/.02/3",
  "16": "Carving Knife/A small, light blade./1/3/.5/0/0/0/1/18/-1/0/.04/3",
  "17": "Iron Dirk/A common dagger./2/4/.5/0/0/0/1/62/50/0/.03/3",
  "18": "Burglar's Shank/A weapon of choice for the swift and silent./7/12/.5/0/5/0/1/114/100/0/.04/3.5",
  "19": "Shadow Dagger/When you hold the blade to your ear you can hear 1,000 souls shrieking./10/20/.5/0/0/0/1/80/50/0/.04/3",
  "20": "Elf Blade/Only the nimble hands of an elf could craft this./3/5/.5/0/5/0/1/-1/-1/0/.04/3",
  "21": "Crystal Dagger/The blade is made of purified quartz./4/10/1/0/10/0/1/-1/-1/0/.03/4",
  "22": "Wind Spire/A swift little blade./1/5/1/0/0/0/1/-1/-1/0/.02/3.2",
  "23": "Galaxy Dagger/It's unlike anything you've seen./30/40/1/3/0/0/1/-1/-1/0/.02/3",
  "24": "Wood Club/A solid piece of wood, crudely chiseled into a club shape./9/16/1.5/-8/0/0/2/32/-1/0/.02/3",
  "25": "Alex's Bat/The sweet spot is dented from Alex's famous Grand Slam./1/3/1/-8/0/0/2/-1/-1/0/.02/3",
  "26": "Lead Rod/It's incredibly heavy./18/27/1.5/-16/0/0/2/56/50/1/.02/3",
  "27": "Wood Mallet/The solid head packs a punch. Relatively light for a club./15/24/1.3/-4/1/0/2/68/50/0/.02/3",
  "28": "The Slammer/An extremely heavy gavel that'll send foes flying./40/55/1.5/-12/0/0/2/128/100/2/.02/3",
  "29": "Galaxy Hammer/It's made from an ultra-light material you've never seen before./70/90/1/-4/0/0/2/-1/-1/0/.02/3",
  "30": "Sam's Old Guitar/It's seen better days./1/3/1/-6/0/0/2/-1/-1/0/.02/3",
  "31": "Femur/An old, heavy bone caked in centuries of grime./6/11/1.5/-4/0/0/2/10/-1/0/.02/3",
  "32": "Slingshot/Requires stones for ammo./1/3/1/308/0/0/4/-1/-1/0/.02/3",
  "33": "Master Slingshot/Requires stones for ammo./1/3/1/308/0/0/4/-1/-1/0/.02/3",
  "34": "Galaxy Slingshot/It looks really powerful./1/3/1/308/0/0/4/-1/-1/0/.02/3",
  "35": "Elliott's Pencil/Elliott used this to write his book. It's sharp!/1/3/1/308/0/0/1/-1/-1/0/.02/3",
  "36": "Maru's Wrench/A big, metal wrench. It smells like Maru./1/3/1/308/0/0/2/-1/-1/0/.02/3",
  "37": "Harvey's Mallet/It brings back memories of Harvey's clinic./1/3/1/308/0/0/2/-1/-1/0/.02/3",
  "38": "Penny's Fryer/Penny's favorite frying pan. There's some rubbery gunk stuck to the inside./1/3/1/308/0/0/2/-1/-1/0/.02/3",
  "39": "Leah's Whittler/Leah's favorite tool for shaping driftwood./1/3/1/308/0/0/1/-1/-1/0/.02/3",
  "40": "Abby's Planchette/It's made from fine marblewood./1/3/1/308/0/0/1/-1/-1/0/.02/3",
  "41": "Seb's Lost Mace/One of Sebastian's medieval replicas./1/3/1/308/0/0/2/-1/-1/0/.02/3",
  "42": "Haley's Iron/It's searing hot and smells like Haley's hair./1/3/1/308/0/0/0/-1/-1/0/.02/3",
  "43": "Pirate's Sword/It looks like a pirate owned this once./8/14/1/4/0/0/3/40/-1/0/.02/3",
  "44": "Cutlass/A finely crafted blade./9/17/1/4/0/0/0/-1/-1/0/.02/3",
  "45": "Wicked Kris/The blade is made of an iridium alloy./24/30/.5/0/8/0/1/-1/-1/2/.06/3",
  "46": "Kudgel/A brute's companion./27/40/1.6/-10/0/0/2/107/100/0/.02/3.1",
  "47": "Scythe/It can cut grass into hay, if you've built a silo./1/3/1/0/0/0/0/-1/-1/0/.02/3",
  "48": "Yeti Tooth/It's icy cold to the touch./26/42/1/0/0/4/0/-1/-1/0/.02/3.2",
  "49": "Rapier/An elegant blade./15/25/1/4/0/0/0/100/95/2/.02/3",
  "50": "Steel Falchion/Light and powerful./28/46/1/8/5/0/0/142/100/0/.02/3.4",
  "51": "Broken Trident/It came from the sea, but it's still sharp./15/26/.5/0/8/0/1/-1/-1/2/.02/3",
  "52": "Tempered Broadsword/It looks like it could withstand anything./29/44/1.2/-6/0/3/0/135/100/1/.02/3",
  "53": "Golden Scythe/It's more powerful than a normal scythe./13/13/1/0/0/0/0/-1/-1/2/.02/4",
  "54": "Dwarf Sword/It's ancient, but the blade never dulls./65/75/1/4/0/4/0/-1/-1/0/.02/3",
  "55": "Dwarf Hammer/It emits a very faint whirring sound./75/85/1/-8/0/2/2/-1/-1/0/.02/3",
  "56": "Dwarf Dagger/It's ancient, but the blade never dulls./32/38/1/3/0/6/1/-1/-1/0/.03/3",
  "57": "Dragontooth Cutlass/The blade was forged from a magical tooth./75/90/1/0/0/0/0/-1/-1/0/.02/4",
  "58": "Dragontooth Club/This club was crafted from a magical tooth./80/100/1.3/-8/0/0/2/-1/-1/0/.02/4",
  "59": "Dragontooth Shiv/The blade was forged from a magical tooth./40/50/1/0/0/0/1/-1/-1/0/.05/5",
  "60": "Ossified Blade/A large, sharp blade formed from bone./26/42/1.1/-4/0/1/0/142/100/0/.02/3",
  "61": "Iridium Needle/The point is unbelievably sharp, even down to the atomic level./20/35/.5/0/0/0/1/-1/-1/0/.1/7",
  "62": "Infinity Blade/The true form of the Galaxy Sword./80/100/1/8/0/2/0/-1/-1/0/.02/3",
  "63": "Infinity Gavel/The true form of the Galaxy Hammer./100/120/1/-4/0/1/2/-1/-1/0/.02/3",
  "64": "Infinity Dagger/The true form of the Galaxy Dagger./50/70/1/3/0/3/1/-1/-1/0/.06/3"
}
</syntaxhighlight>}}
 
==Format==
===Melee weapons===
The weapon data in <samp>Data\Weapons.xnb</samp> contains fifteen fields for melee weapons:
308/0/0/4/-1/-1/0/.02/3
{| class="wikitable"
{| class="wikitable"
|-
|-
! index
! field
! example value
! purpose
! description
|-
| 0
| ''Bone Sword''
| name
|-
| 1
| ''A very light piece of sharpened bone.''
| description
|-
| 2
| ''20''
| minimum damage ouput
|-
| 3
| ''30''
| maximum damage output
|-
| 4
| ''.8''
| knockback (weight) - determines how far the target will get pushed away when hit
|-
| 5
| ''8''
| speed - determines how fast the user can attack
|-
| 6
| ''5''
| added precision - decreases the chance that a strike will cause no damage
|-
| 7
| ''0''
| added defense - affects how much damage the user takes
|-
| 8
| ''0''
| type ("0" for stabbing sword, "1" for dagger, "2" for club/hammer, "3" for slashing sword, "4" for slingshot)
|-
| 9
| ''74''
| The base mine level which affects the probability of [[#Mine container drops|mine container drops]].
|-
| 10
| ''50''
| The minimum mine level for [[#Mine container drops|mine container drops]].
|-
| 11
| ''0''
| added area of effect
|-
| 12
| ''.02''
| critical chance
|-
|-
| 13
| <samp>CustomFields</samp>
| ''3''
| ''(Optional)'' The [[Modding:Common data field types#Custom fields|custom fields]] for this entry.
| critical multiplier
|-
| 14
|
| display name (non-English files only)
|}
|}


Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>).
==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.


===Slingshot===
==For C# mods==
The [[slingshot]] has initial ID 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). All [[#Melee weapons|weapon fields]] must be specified in the weapon data to avoid errors, but only these are actually used for slingshots:
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"
{| class="wikitable"
|-
|-
! index
! method
! example value
! effect
! description
|-
|-
| 0
| <samp>Object.GetRadiusForScarecrow()</samp>
| ''Master Slingshot''
| 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.
| name
|-
|-
| 1
| <samp>Object.IsBar()</samp>
| ''Requires stones for ammo.''
| 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]].
| description
|-
|-
| 9
| <samp>Object.IsBreakableStone()</samp>
| ''74''
| Whether the item is a stone debris item which can be broken by a pickaxe.
| The base mine level which affects the probability of [[#Mine container drops|mine container drops]].
|-
|-
| 10
| <samp>Object.IsFence()</samp>
| ''50''
| Whether the item is a [[Crafting#Fences|fence]].
| The minimum mine level for [[#Mine container drops|mine container drops]].
|-
|-
| 14
| <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.
| display name (non-English files only)
|}
 
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
| <samp>Object.IsHeldOverHead()</samp>
! probability
| Whether the player is shown holding up the item when it's selected in their toolbar. Default true (except for furniture).
|-
|-
| 0
| <samp>Object.IsIncubator()</samp>
| 100%
| Whether the item can incubate [[Animals|farm animal]] eggs when placed in a building.
|-
|-
| 5
| <samp>Object.IsScarecrow()</samp>
| 92%
| 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.
|-
|-
| 10
| <samp>Object.IsTapper()</samp>
| 71%
| Whether the item is a [[Tapper|tapper]] or [[Heavy Tapper|heavy tapper]].
|-
|-
| 15
| <samp>Object.IsTeaSapling()</samp>
| 46%
| Whether the item is a [[Tea Sapling|tea sapling]].
|-
|-
| 20
| <samp>Object.IsTwig()</samp>
| 25%
| Whether the item is a twig debris item.
|-
|-
| 25
| <samp>Object.IsWeeds()</samp>
| 4%
| Whether the item is a weed debris item.
|}
|}
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>
==References==
<references />


==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


[[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