Modding:Buildings
← Index
This page explains how the define custom buildings. This is an advanced guide for mod developers.
Format
You can create/edit buildings by editing the Data/Buildings asset.
This consists of a string → model lookup, where...
- The key is a unique string ID for the building type.
- The value is a model with the fields listed below.
Required fields
field | effect |
---|---|
Name Description |
A tokenizable string for the display name and description (e.g. shown in the construction menu). |
Texture | The asset name for the texture under the game's Content folder. |
Construction
field | effect | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Builder | (Optional) The NPC from whom you can request construction. The vanilla values are Robin and Wizard, but you can specify a different name if a C# mod opens a construction menu for them. Defaults to Robin. If set to null, it won't appear in any menu. | ||||||||||
BuildCost | (Optional) The gold cost to construct the building. Defaults to 0g. | ||||||||||
BuildMaterials | (Optional) The materials you must provide to start construction, as a list of models with these fields:
| ||||||||||
BuildDays | (Optional) The number of days needed to complete construction (e.g. 1 for a building completed the next day). If set to 0, construction finishes instantly. Defaults to 0. | ||||||||||
BuildCondition | (Optional) A game state query which indicates whether the building should be available in the construction menu. Defaults to always available. | ||||||||||
BuildMenuDrawOffset | (Optional) A pixel offset to apply to the building sprite when drawn in the construction menu. Default none. | ||||||||||
AdditionalPlacementTiles | (Optional) The extra tiles to treat as part of the building when placing it through the construction menu. For example, the farmhouse uses this to make sure the stairs are clear. This consists of a list of models with these fields:
| ||||||||||
IndoorItems | (Optional) The items to place in the building interior when it's constructed or upgraded. This consists of a list of models with these fields:
| ||||||||||
MagicalConstruction | (Optional) Whether the building is magical. This changes the carpenter menu to a mystic theme while this building's blueprint is selected, and completes the construction instantly when placed. | ||||||||||
AddMailOnBuild | (Optional) A list of letter IDs to send to all players when the building is constructed for the first time. |
Upgrades
field | effect | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BuildingToUpgrade | (Optional) The ID of the building for which this is an upgrade, or omit to allow constructing it as a new building. For example, the Big Coop sets this to "Coop". Any numbers of buildings can be an upgrade for the same building, in which case the player can choose one upgrade path. | ||||||||||
IndoorItemMoves | (Optional) When applied as an upgrade to an existing building, the placed items in its interior to move when transitioning to the new map. This is a list of models with these fields:
| ||||||||||
UpgradeSignTile | (Optional) The tile position relative to the top-left corner of the building where the upgrade sign will be placed when Robin is building an upgrade, in the form "<x> , <y> ". Defaults to approximately "5, 1" if the building interior type is Shed, else "0, 0".
| ||||||||||
UpgradeSignHeight | (Optional) The pixel height of the upgrade sign when Robin is building an upgrade. Defaults to 0. |
Exterior behavior
field | effect |
---|---|
Size | (Optional) The building's width and height when constructed, measured in tiles. Defaults to a 1 x 1 area. |
CollisionMap | (Optional) An ASCII text block which indicates which of the building's tiles the players can walk onto, where each character can be X (blocked) or O (passable). Defaults to all tiles blocked.
For example, a stable covers a 2x4 tile area with the front two tiles passable: XXXX XOOX When the collision map is parsed, leading/trailing whitespace is trimmed (both for the entire map and for each line). In JSON, you can specify it in two forms: // single line with \n line breaks
"CollisionMap": "XXXX\nXOOX"
// multi-line with optional indentation
"CollisionMap": "
XXXX
XOOX
"
|
HumanDoor | (Optional) The position of the door that can be clicked to warp into the building interior. This is measured in tiles relative to the top-left corner tile. Defaults to disabled. |
AnimalDoor | (Optional) The position and size of the door that animals use to enter/exit the building, if the building interior is an animal location, specified as an object with X, Y, Width, and Height fields. This is measured in tiles relative to the top-left corner tile. Defaults to disabled. |
AnimalDoorOpenDuration AnimalDoorCloseDuration |
(Optional) The duration of the open/close animation for the animal door, measured in milliseconds. If omitted, the door switches to the open/closed state instantly. |
AnimalDoorOpenSound AnimalDoorCloseSound |
(Optional) The sound which is played once each time the animal door is opened/closed. Disabled by default. |
Exterior appearance
field | effect | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SourceRect | (Optional) The building's pixel area within the Texture, specified as an object with X, Y, Width, and Height fields. Defaults to the entire texture. | ||||||||||||||||||||
Skins | (Optional) The appearances which can be selected from Robin's menu (like stone/plank/log cabins), in addition to the default appearance based on Texture. This consists of a list of models with these fields:
| ||||||||||||||||||||
FadeWhenBehind | (Optional) Whether the building should become semi-transparent when the player is behind it. Default true. | ||||||||||||||||||||
DrawOffset | (Optional) A pixel offset applied to the building sprite's placement in the world. Default 0. | ||||||||||||||||||||
SeasonOffset | (Optional) A pixel offset to apply each season. This is applied to the SourceRect position by multiplying the offset by 0 (spring), 1 (summer), 2 (fall), or 3 (winter). Default 0, so all seasons use the same source rect. | ||||||||||||||||||||
SortTileOffset | (Optional) A Y tile offset applied when figuring out render layering. For example, a value of 2.5 will treat the building as if it was 2.5 tiles further up the screen for the purposes of layering. Default 0. | ||||||||||||||||||||
AllowsFlooringUnderneath | (Optional) Whether flooring can be placed underneath, and when the building is placed, if it will leave flooring beneath it. Default true. | ||||||||||||||||||||
DrawLayers | (Optional) A list of textures to draw over or behind the building, with support for conditions and animations. This consists of a list of models with these fields:
| ||||||||||||||||||||
DrawShadow | (Optional) Whether to draw an automatic shadow along the bottom edge of the building's sprite. Default true. |
Interior
field | effect |
---|---|
IndoorMap | (Optional) The name of the map asset under Maps to load for the building interior. For example, "Shed" will load the shed's Maps/Shed map. |
IndoorMapType | (Optional) The full name of the C# location class which will manage the building's interior location. This must be one of the vanilla types to avoid a crash when saving. There are too many to list here, but the most useful types are likely...
Defaults to the generic StardewValley.GameLocation class. |
NonInstancedIndoorLocation | (Optional) The name of the existing global location to treat as the building's interior, like FarmHouse and Greenhouse for their buildings.
Each location can only be used by one building. If the location is already in use (e.g. because the player has two of this building), each subsequent building will use the IndoorMap and IndoorMapType instead. For example, the first greenhouse will use the global Greenhouse location, and any subsequent greenhouse will use a separate instanced location. |
MaxOccupants | (Optional) The maximum number of animals who can live in this building. |
AllowAnimalPregnancy | (Optional) Whether animals can get pregnant and produce offspring in this building. Default false. |
ValidOccupantTypes | (Optional) A list of building IDs whose animals to allow in this building too. For example, [ "Barn", "Coop" ] will allow barn and coop animals in this building. Default none.
|
Note: the player's entry position after entering the building will be 1 tile North of the first warp in the location's warp list.
Item processing
field | effect | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HayCapacity | (Optional) The amount of hay that can be stored in this building. If built on the farm, this works just like silos and contributes to the farm's available hay. | ||||||||||||||||||||||
ItemConversions | (Optional) The item processing rules which take input items and convert them into output items using the inventories defined by Chests. This consists of a list of models with these fields:
| ||||||||||||||||||||||
Chests | (Optional) The input/output inventories that can be accessed from a tile on the building exterior. The allowed items are defined by the separate ItemConversions field. This is a list of models with these fields:
|
Tile interactions
field | effect | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ActionTiles | (Optional) A list of tiles which the player can click to trigger an Action map tile property. This consists of a list of models with these fields:
| ||||||||||||
DefaultAction | (Optional) The default tile action if the clicked tile isn't in ActionTiles. Default none. | ||||||||||||
TileProperties | (Optional) The map tile properties to set. This consists of a list of models with these fields:
| ||||||||||||
AdditionalTilePropertyRadius | (Optional) When checking whether the player clicked on a TileProperties tile, an added distance around the building at which tile locations may be placed. Default 0, so only tile properties within the normal building bounds will work. |
Advanced
field | effect | ||||||
---|---|---|---|---|---|---|---|
Metadata | (Optional) A list of custom properties applied to the building, which can optionally be overridden per-skin in the Skins field. Default none.
The base game recognizes these properties:
This can also contain arbitrary custom properties, which C# mods can read using building.GetMetadata(key). | ||||||
BuildingType | (Optional) The full name of the C# type to instantiate for the building instance. Defaults to a generic Building instance.
⚠ Caution: this is meant to support vanilla building types like StardewValley.Shed. Setting this to a non-vanilla type will cause a crash when it's written to the save file, and may cause crashes in multiplayer. If you need custom behavior, consider handling it in C# based on the building type instead of creating a custom subclass; otherwise you'll need a framework mod like SpaceCore to handle serialization and multiplayer sync. | ||||||
ModData | (Optional) A string → string lookup of arbitrary modData values to attach to the building when it's constructed. | ||||||
CustomFields | The custom fields for this entry. |