Show / Hide Table of Contents

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.
Inheritance
System.Object
CustomEntity
CustomItem
Inherited Members
CustomEntity.SourceMod
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 Source

CustomItem(GameObject, Boolean)

Custom item from a prefab.
Can fix references for Mock<T>s and the .
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.
| Improve this Doc View Source

CustomItem(GameObject, Boolean, ItemConfig)

Custom item from a prefab with a made from a ItemConfig.
Can fix references for Mock<T>s.
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.
| Improve this Doc View Source

CustomItem(String, Boolean)

Custom item created as an "empty" primitive.
At least the name and the Icon of the must be edited after creation.
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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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 Source

FixReference

Indicator if references from Mock<T>s will be replaced at runtime.
Declaration
public bool FixReference { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ItemDrop

The component for this custom item as a shortcut.
Declaration
public ItemDrop ItemDrop { get; }
Property Value
Type Description
ItemDrop
| Improve this Doc View Source

ItemPrefab

The prefab for this custom item.
Declaration
public GameObject ItemPrefab { get; }
Property Value
Type Description
GameObject
| Improve this Doc View Source

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 Source

Equals(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.
| Improve this Doc View Source

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
| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Extension Methods

PrefabExtension.FixReferences(Object)
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾