Exemple #1
0
        public void OnGenerated(IBlockAccessor blockAccessor, LCGRandom rnd, BlockMushroom block)
        {
            setMushroomBlock(block);

            MyceliumSystem.lcgrnd.InitPositionSeed(mushroomBlockCode.GetHashCode(), (int)(mushroomBlock as BlockMushroom).Api.World.Calendar.GetHemisphere(Pos));
            if (MyceliumSystem.lcgrnd.NextDouble() < 0.33)
            {
                mushroomsGrowingDays = MyceliumSystem.lcgrnd.NextDouble() * 10;
                return;
            }
            growMushrooms(blockAccessor, rnd);
        }
Exemple #2
0
        bool setMushroomBlock(Block block)
        {
            this.mushroomBlock     = block;
            this.mushroomBlockCode = block.Code;

            if (Api != null)
            {
                if (block?.Attributes?["mushroomProps"].Exists != true)
                {
                    return(false);
                }

                if (block != null)
                {
                    props = block.Attributes["mushroomProps"].AsObject <MushroomProps>();
                }
                MyceliumSystem.lcgrnd.InitPositionSeed(mushroomBlockCode.GetHashCode(), (int)Api.World.Calendar.GetHemisphere(Pos) + 5);

                fruitingDays = 20 + MyceliumSystem.lcgrnd.NextDouble() * 20;
                growingDays  = 10 + MyceliumSystem.lcgrnd.NextDouble() * 10;
            }

            return(true);
        }