예제 #1
0
        /// <summary>
        /// Creates a deep copy
        /// </summary>
        /// <returns></returns>
        public GridRecipe Clone()
        {
            GridRecipe recipe = new GridRecipe();

            recipe.RecipeGroup       = RecipeGroup;
            recipe.Width             = Width;
            recipe.Height            = Height;
            recipe.IngredientPattern = IngredientPattern;
            recipe.Ingredients       = new Dictionary <string, CraftingRecipeIngredient>();
            if (Ingredients != null)
            {
                foreach (var val in Ingredients)
                {
                    recipe.Ingredients[val.Key] = val.Value.Clone();
                }
            }
            if (resolvedIngredients != null)
            {
                recipe.resolvedIngredients = new GridRecipeIngredient[resolvedIngredients.Length];
                for (int i = 0; i < resolvedIngredients.Length; i++)
                {
                    recipe.resolvedIngredients[i] = resolvedIngredients[i]?.CloneTo <GridRecipeIngredient>();
                }
            }

            recipe.Shapeless          = Shapeless;
            recipe.Output             = Output.Clone();
            recipe.Name               = Name;
            recipe.Attributes         = Attributes?.Clone();
            recipe.RequiresTrait      = RequiresTrait;
            recipe.AverageDurability  = AverageDurability;
            recipe.CopyAttributesFrom = CopyAttributesFrom;

            return(recipe);
        }
예제 #2
0
 public virtual void OnCreatedByCrafting(ItemSlot[] allInputslots, ItemSlot outputSlot, GridRecipe byRecipe, ref EnumHandling handled)
 {
     handled = EnumHandling.PassThrough;
 }