Exemple #1
0
        /// <summary>
        /// Creates a deep copy
        /// </summary>
        /// <returns></returns>
        public CombustibleProperties Clone()
        {
            CombustibleProperties cloned = new CombustibleProperties();

            cloned.BurnDuration      = BurnDuration;
            cloned.BurnTemperature   = BurnTemperature;
            cloned.HeatResistance    = HeatResistance;
            cloned.MeltingDuration   = MeltingDuration;
            cloned.MeltingPoint      = MeltingPoint;
            cloned.SmokeLevel        = SmokeLevel;
            cloned.SmeltedRatio      = SmeltedRatio;
            cloned.RequiresContainer = RequiresContainer;
            cloned.SmeltingType      = SmeltingType;
            cloned.MaxTemperature    = MaxTemperature;

            if (SmeltedStack != null)
            {
                cloned.SmeltedStack = SmeltedStack.Clone();
            }


            return(cloned);
        }
        public static BakingProperties ReadFrom(ItemStack stack)
        {
            if (stack == null)
            {
                return(null);
            }

            BakingProperties result = stack.Collectible?.Attributes?["bakingProperties"]?.AsObject <BakingProperties>();

            if (result == null)
            {
                return(null);
            }

            if (result.Temp == null || result.Temp == 0)
            {
                CombustibleProperties props = stack.Collectible.CombustibleProps;
                if (props != null)
                {
                    result.Temp = props.MeltingPoint - 40;
                }
            }
            return(result);
        }