Example #1
0
        /// <summary>
        /// Gets the amount of light on a block taking into account sunlight
        /// </summary>
        public virtual int GetBlockLightValue(int par1, int par2, int par3, int par4)
        {
            ExtendedBlockStorage extendedblockstorage = storageArrays[par2 >> 4];

            if (extendedblockstorage == null)
            {
                if (!WorldObj.WorldProvider.HasNoSky && par4 < SkyBlock.Sky.DefaultLightValue)
                {
                    return(SkyBlock.Sky.DefaultLightValue - par4);
                }
                else
                {
                    return(0);
                }
            }

            int i = WorldObj.WorldProvider.HasNoSky ? 0 : extendedblockstorage.GetExtSkylightValue(par1, par2 & 0xf, par3);

            if (i > 0)
            {
                IsLit = true;
            }

            i -= par4;
            int j = extendedblockstorage.GetExtBlocklightValue(par1, par2 & 0xf, par3);

            if (j > i)
            {
                i = j;
            }

            return(i);
        }
Example #2
0
        /// <summary>
        /// Gets the amount of light saved in this block (doesn't adjust for daylight)
        /// </summary>
        public virtual int GetSavedLightValue(SkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
        {
            ExtendedBlockStorage extendedblockstorage = storageArrays[par3 >> 4];

            if (extendedblockstorage == null)
            {
                return(par1EnumSkyBlock.DefaultLightValue);
            }

            if (par1EnumSkyBlock == SkyBlock.Sky)
            {
                return(extendedblockstorage.GetExtSkylightValue(par2, par3 & 0xf, par4));
            }

            if (par1EnumSkyBlock == SkyBlock.Block)
            {
                return(extendedblockstorage.GetExtBlocklightValue(par2, par3 & 0xf, par4));
            }
            else
            {
                return(par1EnumSkyBlock.DefaultLightValue);
            }
        }