Class ItemConfig
Configuration class for adding custom items. Automatically creates a recipe for this item.
Use this in a constructor of CustomItem and Jötunn resolves the references to the game objects at runtime.
Use this in a constructor of CustomItem and Jötunn resolves the references to the game objects at runtime.
Inherited Members
Namespace: Jotunn.Configs
Assembly: Jotunn.dll
Syntax
public class ItemConfig
Fields
| Name | Description |
|---|---|
| StackSize | Maximum stack size. Values lower than 1 are ignored when applying the config. Defaults to -1. |
Properties
| Name | Description |
|---|---|
| Amount | The amount of Item that will be created when crafting this item. Defaults to 1. |
| CraftingStation | The name of the crafting station prefab where this recipe can be crafted. Can be set to null to have the recipe be craftable without a crafting station. |
| Description | The description of your item. May be tokenized. |
| Enabled | Whether this item is craftable or not. Defaults to true. |
| Icon | Gets or sets the first icon of the item. For item variants with multiple icons, use the Icons property instead. |
| Icons | Icons for this item. If more than one icon is added, this item automatically has variants. |
| Item | The name of the item prefab. Is automatically set in CustomItem. |
| MinStationLevel | The minimum required level for the crafting station. Defaults to 1. |
| Name | The unique name for your item. May be tokenized. |
| PieceTable | The name of the piece table prefab this item uses to build pieces. |
| QualityResultAmountMultiplier | Multiplier for the amount of items created by the recipe based on the quality of the crafting materials. Defaults to 1. |
| RepairStation | The name of the crafting station prefab where this item can be repaired. Can be set to null to have the item be repairable without a crafting station. |
| RequireOnlyOneIngredient | Whether this recipe requires only one of the crafting requirements to be crafted. Defaults to false. |
| Requirements | Array of RequirementConfigs for all crafting materials it takes to craft the recipe. |
| StyleTex | Texture holding the variants different styles. |
| Weight | Weight of a single item in an inventory. Values lower than 0 are ignored when applying the config. Defaults to -1. |
Methods
| Name | Description |
|---|---|
| AddRequirement(RequirementConfig) | Appends a new RequirementConfig to the array of existing ones. If the requirement is null or is not valid (has not item name or amount set) nothing will be added. |
| AddRequirement(string, int, int) | Appends a new RequirementConfig to the array of existing ones. If the item name is null or empty or the amount is less than 1 nothing will be added. |
| Apply(GameObject) | Apply this config's values to a GameObject's ItemDrop. |
| FromJson(string) | Loads a single ItemConfig from a JSON string |
| GetRecipe() | Converts the ItemConfig to a Valheim style Recipe. |
| GetRequirements() | Converts the RequirementConfigs to Valheim style Piece.Requirements |
| ListFromJson(string) | Loads a list of ItemConfigs from a JSON string |