/// <summary> /// Custom item created as a copy of a vanilla Valheim prefab. /// </summary> /// <param name="name">The new name of the prefab after cloning.</param> /// <param name="basePrefabName">The name of the base prefab the custom item is cloned from.</param> public CustomItem(string name, string basePrefabName) { ItemPrefab = PrefabManager.Instance.CreateClonedPrefab(name, basePrefabName); if (ItemPrefab) { ItemDrop = ItemPrefab.GetComponent <ItemDrop>(); } }
/// <summary> /// Custom item created as a copy of a vanilla Valheim prefab with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>. /// </summary> /// <param name="name">The new name of the prefab after cloning.</param> /// <param name="basePrefabName">The name of the base prefab the custom item is cloned from.</param> /// <param name="itemConfig">The recipe config for this custom item.</param> public CustomItem(string name, string basePrefabName, ItemConfig itemConfig) { ItemPrefab = PrefabManager.Instance.CreateClonedPrefab(name, basePrefabName); if (ItemPrefab) { ItemDrop = ItemPrefab.GetComponent <ItemDrop>(); itemConfig.Item = name; Recipe = new CustomRecipe(itemConfig.GetRecipe(), true, true); } }