public IronBigShovelRecipe() { try { CraftingStorage storage = BigShovelPlugin.Conf.Get <ToolStorage>("IronBigShovel").craft; this.Products = new CraftingElement[] { new CraftingElement <IronBigShovelItem>() }; this.Ingredients = new CraftingElement[storage.ingredients.Length]; for (int i = 0; i < storage.ingredients.Length; i++) { CraftIngredients current = storage.ingredients[i]; var genericListType = typeof(CraftingElement <>); var specificListType = genericListType.MakeGenericType(Item.GetType(current.item)); var craftElem = Activator.CreateInstance(specificListType, new object[] { typeof(MetalworkingEfficiencySkill), current.quantity, MetalworkingEfficiencySkill.MultiplicativeStrategy }); this.Ingredients[i] = craftElem as CraftingElement; } if (storage.enable) { CraftingComponent.AddRecipe(BigShovelPlugin.GetTypeFromString(storage.table), this); } this.CraftMinutes = CreateCraftTimeValue(typeof(IronBigShovelRecipe), Item.Get <IronBigShovelItem>().UILink(), storage.craftMinutesTime, typeof(MetalworkingSpeedSkill)); this.Initialize("Iron Big Shovel", typeof(IronBigShovelRecipe)); } catch (Exception e) { Console.WriteLine("[BigShovel] - A error occured when setting IronBigShovelCraft - " + e.Message); return; } }
public ToolStorage(float _durability, float _calories, CraftIngredients _repair, CraftingStorage _craft) { durability = _durability; calories = _calories; repair = _repair; craft = _craft; }