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.
Inheritance
System.Object
ItemConfig
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Jotunn.Configs
Assembly: Jotunn.dll
Syntax
public class ItemConfig
Properties
| Improve this Doc View SourceAmount
The amount of Item that will be created when crafting this item. Defaults to
1
.
Declaration
public int Amount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
CraftingStation
The name of the crafting station prefab where this recipe can be crafted.
Can be set to
Can be set to
null
to have the recipe be craftable without a crafting station.
Declaration
public string CraftingStation { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Description
The description of your item. May be tokenized.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Enabled
Whether this item is craftable or not. Defaults to
true
.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Icons
Icons for this item. If more than one icon is added, this item automatically has variants.
Declaration
public Sprite[] Icons { get; set; }
Property Value
Type | Description |
---|---|
Sprite[] |
Item
The name of the item prefab. Is automatically set in CustomItem.
Declaration
public string Item { get; }
Property Value
Type | Description |
---|---|
System.String |
MinStationLevel
The minimum required level for the crafting station. Defaults to
1
.
Declaration
public int MinStationLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
The unique name for your item. May be tokenized.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PieceTable
The name of the piece table prefab this item uses to build pieces.
Declaration
public string PieceTable { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RepairStation
The name of the crafting station prefab where this item can be repaired.
Can be set to
Can be set to
null
to have the item be repairable without a crafting station.
Declaration
public string RepairStation { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Requirements
Array of RequirementConfigs for all crafting materials it takes to craft the recipe.
Declaration
public RequirementConfig[] Requirements { get; set; }
Property Value
Type | Description |
---|---|
RequirementConfig[] |
StyleTex
Texture holding the variants different styles.
Declaration
public Texture2D StyleTex { get; set; }
Property Value
Type | Description |
---|---|
Texture2D |
Methods
| Improve this Doc View SourceApply(GameObject)
Apply this config's values to a GameObject's ItemDrop.
Declaration
public void Apply(GameObject prefab)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab |
FromJson(String)
Loads a single ItemConfig from a JSON string
Declaration
public static ItemConfig FromJson(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | JSON text |
Returns
Type | Description |
---|---|
ItemConfig | Loaded ItemConfig |
GetRecipe()
Converts the ItemConfig to a Valheim style Recipe.
Declaration
public Recipe GetRecipe()
Returns
Type | Description |
---|---|
Recipe | The Valheim recipe |
GetRequirements()
Converts the RequirementConfigs to Valheim style Piece.Requirements
Declaration
public Piece.Requirement[] GetRequirements()
Returns
Type | Description |
---|---|
Piece.Requirement[] | The Valheim Piece.Requirement array |
ListFromJson(String)
Loads a list of ItemConfigs from a JSON string
Declaration
public static List<ItemConfig> ListFromJson(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | JSON text |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<ItemConfig> | Loaded list of ItemConfigs |