Class CustomItem
Main interface for adding custom items to the game.
All custom items have to be wrapped inside this class to add it to Jötunns ItemManager.
All custom items have to be wrapped inside this class to add it to Jötunns ItemManager.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Jotunn.Entities
Assembly: Jotunn.dll
Syntax
public class CustomItem : CustomEntity
Constructors
| Improve this Doc View SourceCustomItem(GameObject, Boolean)
Declaration
public CustomItem(GameObject itemPrefab, bool fixReference)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | itemPrefab | The prefab for this custom item. |
| System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
CustomItem(GameObject, Boolean, ItemConfig)
Declaration
public CustomItem(GameObject itemPrefab, bool fixReference, ItemConfig itemConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | itemPrefab | The prefab for this custom item. |
| System.Boolean | fixReference | If true references for Mock<T> objects get resolved at runtime by Jötunn. |
| ItemConfig | itemConfig | The item config for this custom item. |
CustomItem(String, Boolean)
Custom item created as an "empty" primitive.
At least the name and the Icon of the must be edited after creation.
At least the name and the Icon of the
Declaration
public CustomItem(string name, bool addZNetView)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the new prefab. Must be unique. |
| System.Boolean | addZNetView | If true a ZNetView component will be added to the prefab for network sync. |
CustomItem(String, Boolean, ItemConfig)
Custom item created as an "empty" primitive with a made from a ItemConfig.
Declaration
public CustomItem(string name, bool addZNetView, ItemConfig itemConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Name of the new prefab. Must be unique. |
| System.Boolean | addZNetView | If true a ZNetView component will be added to the prefab for network sync. |
| ItemConfig | itemConfig | The item config for this custom item. |
CustomItem(String, String)
Custom item created as a copy of a vanilla Valheim prefab.
Declaration
public CustomItem(string name, string basePrefabName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The new name of the prefab after cloning. |
| System.String | basePrefabName | The name of the base prefab the custom item is cloned from. |
CustomItem(String, String, ItemConfig)
Custom item created as a copy of a vanilla Valheim prefab with a made from a ItemConfig.
Declaration
public CustomItem(string name, string basePrefabName, ItemConfig itemConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The new name of the prefab after cloning. |
| System.String | basePrefabName | The name of the base prefab the custom item is cloned from. |
| ItemConfig | itemConfig | The item config for this custom item. |
Properties
| Improve this Doc View SourceFixReference
Indicator if references from Mock<T>s will be replaced at runtime.
Declaration
public bool FixReference { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ItemDrop
The component for this custom item as a shortcut.
Declaration
public ItemDrop ItemDrop { get; }
Property Value
| Type | Description |
|---|---|
| ItemDrop |
ItemPrefab
The prefab for this custom item.
Declaration
public GameObject ItemPrefab { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
Recipe
The CustomRecipe associated with this custom item. Is needed to craft
this item on a workbench or from the players crafting menu.
Declaration
public CustomRecipe Recipe { get; set; }
Property Value
| Type | Description |
|---|---|
| CustomRecipe |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
IsCustomItem(String)
Helper method to determine if a prefab with a given name is a custom item created with Jötunn.
Declaration
public static bool IsCustomItem(string prefabName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | prefabName | Name of the prefab to test. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the prefab is added as a custom item to the ItemManager. |
IsValid()
Checks if a custom item is valid (i.e. has a prefab, an ItemDrop and an icon, if it should be craftable).
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if all criteria is met |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
System.Object.ToString()