Example #1
0
        protected async Task GenerateOre(IWorld world, ChunkWorldPos chunkWorldPos, GeneratorSettings settings)
        {
            var oreGenerator = GrainFactory.GetGrain <IMinableGenerator>(0);
            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.Dirt(), settings.DirtCount, settings.DirtSize, settings.DirtMinHeight, settings.DirtMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.Gravel(), settings.GravelCount, settings.GravelSize, settings.GravelMinHeight, settings.GravelMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.Granite(), settings.GraniteCount, settings.GraniteSize, settings.GraniteMinHeight, settings.GraniteMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.Diorite(), settings.DioriteCount, settings.DioriteSize, settings.DioriteMinHeight, settings.DioriteMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.Andesite(), settings.AndesiteCount, settings.AndesiteSize, settings.AndesiteMinHeight, settings.AndesiteMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.CoalOre(), settings.CoalCount, settings.CoalSize, settings.CoalMinHeight, settings.CoalMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.IronOre(), settings.IronCount, settings.IronSize, settings.IronMinHeight, settings.IronMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.GoldOre(), settings.GoldCount, settings.GoldSize, settings.GoldMinHeight, settings.GoldMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.DiamondOre(), settings.DiamondCount, settings.DiamondSize, settings.DiamondMinHeight, settings.DiamondMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.RedstoneOre(), settings.RedstoneCount, settings.RedstoneSize, settings.RedstoneMinHeight, settings.RedstoneMaxHeight);

            await oreGenerator.Generate(world, chunkWorldPos, BlockStates.LapisLazuliOre(), settings.LapisCount, settings.LapisSize, settings.LapisCenterHeight - settings.LapisSpread, settings.LapisCenterHeight + settings.LapisSpread);
        }
        public override Task OnActivateAsync()
        {
            if (this.GetPrimaryKeyLong() == (long)BiomeId.Savanna)
            {
                BiomeProperties.BaseHeight      = 0.125f;
                BiomeProperties.HeightVariation = 0.05f;
                BiomeProperties.Temperature     = 1.2f;
                BiomeProperties.Rainfall        = 0.0f;
                BiomeProperties.EnableSnow      = false;
                BiomeProperties.WaterColor      = 16777215;
                BiomeProperties.EnableRain      = false;
            }

            TopBlock    = BlockStates.GrassBlock();
            FillerBlock = BlockStates.Dirt();

            PlantsList.Add(PlantsType.TallGrass);
            PlantsList.Add(PlantsType.AcaciaTree);

            PassiveMobList.Add(MobType.Cow);
            PassiveMobList.Add(MobType.Sheep);
            PassiveMobList.Add(MobType.Horse);

            MonsterList.Add(MobType.Creeper);
            MonsterList.Add(MobType.Skeleton);
            MonsterList.Add(MobType.Zombie);
            MonsterList.Add(MobType.Spider);

            return(Task.CompletedTask);
        }
Example #3
0
        public Biome(BiomeProperties properties, GeneratorSettings genSettings)
        {
            _genSettings = genSettings;

            _name            = properties.BiomeName;
            _biomeId         = properties.BiomeId;
            _baseHeight      = properties.BaseHeight;
            _heightVariation = properties.HeightVariation;
            _temperature     = properties.Temperature;
            _rainfall        = properties.Rainfall;
            _waterColor      = properties.WaterColor;
            _enableSnow      = properties.EnableSnow;
            _enableRain      = properties.EnableRain;

            _dirtGen = new MinableGenerator(
                BlockStates.Dirt(),
                genSettings.DirtSize);
            _gravelOreGen = new MinableGenerator(
                BlockStates.Gravel(),
                genSettings.GravelSize);
            _graniteGen = new MinableGenerator(
                BlockStates.Stone(StoneType.Granite),
                genSettings.GraniteSize);
            _dioriteGen = new MinableGenerator(
                BlockStates.Stone(StoneType.Diorite),
                genSettings.DioriteSize);
            _andesiteGen = new MinableGenerator(
                BlockStates.Stone(StoneType.Andesite),
                genSettings.AndesiteSize);
            _coalGen = new MinableGenerator(
                BlockStates.CoalOre(),
                genSettings.CoalSize);
            _ironGen = new MinableGenerator(
                BlockStates.IronOre(),
                genSettings.IronSize);
            _goldGen = new MinableGenerator(
                BlockStates.GoldOre(),
                genSettings.GoldSize);
            _redstoneGen = new MinableGenerator(
                BlockStates.RedstoneOre(),
                genSettings.RedstoneSize);
            _diamondGen = new MinableGenerator(
                BlockStates.DiamondOre(),
                genSettings.DiamondSize);
            _lapisGen = new MinableGenerator(
                BlockStates.LapisLazuliOre(),
                genSettings.LapisSize);

            _treesPerChunk     = 0;     // mc 0
            _extraTreeChance   = 0.05F; // mc 0.05F
            _grassPerChunk     = 10;
            _flowersPerChunk   = 4;
            _mushroomsPerChunk = 0;

            _deadBushPerChunk = 2;
            _reedsPerChunk    = 50;
            _cactiPerChunk    = 10;
        }
Example #4
0
 public bool CanFlowerGrow(PlantsType type, ChunkColumnStorage chunk, BlockChunkPos pos)
 {
     if (chunk[pos.X, pos.Y - 1, pos.Z] == BlockStates.GrassBlock() ||
         chunk[pos.X, pos.Y - 1, pos.Z] == BlockStates.Dirt())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static bool CanSustainTree(PlantsType type, BlockState state)
 {
     if (state == BlockStates.Dirt() ||
         state == BlockStates.GrassBlock())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
        public void IsSameIdTest()
        {
            BlockState state1 = BlockStates.Dirt();
            BlockState state2 = BlockStates.Dirt();
            BlockState state3 = BlockStates.Wood(WoodType.Birch);
            BlockState state4 = BlockStates.Wood(WoodType.Oak);

            Assert.True(state1 == state2);
            Assert.False(state1 == state3);
            Assert.False(state3.IsSameId(state2));
            Assert.True(state3.IsSameId(state4));
        }
 public static bool IsSoil(BlockState state)
 {
     if (state == BlockStates.Dirt() ||
         state == BlockStates.GrassBlock())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #8
0
        public void IsSameIdTest()
        {
            BlockState state1 = BlockStates.Dirt();
            BlockState state2 = BlockStates.Dirt();
            BlockState state3 = BlockStates.BirchLog();
            BlockState state4 = BlockStates.OakLog();

            Assert.True(state1 == state2);
            Assert.False(state1 == state3);
            Assert.False(state3.IsSameId(state2));
            Assert.False(state3.IsSameId(state4));
        }
Example #9
0
 public static Block FromBlockState(BlockState blockState)
 {
     if (blockState == BlockStates.Air())
     {
         return(new BlockAir());
     }
     else if (blockState.IsId(BlockId.Stone))
     {
         var stone = new BlockStone();
         stone.BlockState = blockState;
         return(stone);
     }
     else if (blockState == BlockStates.GrassBlock())
     {
         return(new BlockGrassBlock());
     }
     else if (blockState == BlockStates.Dirt())
     {
         return(new BlockDirt());
     }
     else if (blockState == BlockStates.Cobblestone())
     {
         return(new BlockCobblestone());
     }
     else if (blockState.IsId(BlockId.WoodPlanks))
     {
         var planks = new BlockWoodPlanks();
         planks.BlockState = blockState;
         return(planks);
     }
     else if (blockState.IsId(BlockId.Sapling))
     {
         var planks = new BlockSapling();
         planks.BlockState = blockState;
         return(planks);
     }
     else if (blockState == BlockStates.Bedrock())
     {
         return(new BlockBedrock());
     }
     else if (blockState == BlockStates.Water())
     {
         return(new BlockWater());
     }
     else
     {
         return(new BlockAir());
     }
 }
Example #10
0
        public override Task OnActivateAsync()
        {
            if (this.GetPrimaryKeyLong() == (long)BiomeId.Plains)
            {
                BiomeProperties.BaseHeight      = 0.125f;
                BiomeProperties.HeightVariation = 0.05f;
                BiomeProperties.Temperature     = 0.8f;
                BiomeProperties.Rainfall        = 0.4f;
                BiomeProperties.EnableSnow      = false;
            }
            else if (this.GetPrimaryKeyLong() == (long)BiomeId.SunflowerPlains)
            {
                BiomeProperties.BaseHeight      = 0.125f;
                BiomeProperties.HeightVariation = 0.05f;
                BiomeProperties.Temperature     = 0.8f;
                BiomeProperties.Rainfall        = 0.4f;
                BiomeProperties.EnableSnow      = false;
            }
            else if (this.GetPrimaryKeyLong() == (long)BiomeId.SnowyTundra)
            {
                BiomeProperties.BaseHeight      = 0.125f;
                BiomeProperties.HeightVariation = 0.05f;
                BiomeProperties.Temperature     = 0.0f;
                BiomeProperties.Rainfall        = 0.5f;
                BiomeProperties.EnableSnow      = true;
            }

            BiomeProperties.WaterColor = 16777215;
            BiomeProperties.EnableRain = true;
            TopBlock    = BlockStates.GrassBlock();
            FillerBlock = BlockStates.Dirt();

            PlantsList.Add(PlantsType.TallGrass);
            PlantsList.Add(PlantsType.Poppy);
            PlantsList.Add(PlantsType.Dandelion);

            PassiveMobList.Add(MobType.Cow);
            PassiveMobList.Add(MobType.Sheep);
            PassiveMobList.Add(MobType.Horse);
            PassiveMobList.Add(MobType.Donkey);

            MonsterList.Add(MobType.Creeper);
            MonsterList.Add(MobType.Skeleton);
            MonsterList.Add(MobType.Zombie);
            MonsterList.Add(MobType.Spider);

            return(Task.CompletedTask);
        }
Example #11
0
 public BlockDirt()
 {
     FullBlock             = true;
     LightOpacity          = 255;
     Translucent           = false;
     LightValue            = 0;
     UseNeighborBrightness = false;
     BlockHardness         = 1.0f;
     BlockResistance       = 0.0f;
     EnableStats           = false;
     NeedsRandomTick       = false;
     IsBlockContainer      = false;
     BlockSoundType        = null;
     BlockParticleGravity  = 1.0f;
     BlockState            = BlockStates.Dirt();
     UnlocalizedName       = "dirt";
 }
Example #12
0
        public override void GenerateBiomeTerrain(int seaLevel, Random rand, ChunkColumnStorage chunk, int chunk_x, int chunk_z, int x_in_chunk, int z_in_chunk, double noiseVal)
        {
            _topBlock    = BlockStates.GrassBlock();
            _fillerBlock = BlockStates.Dirt();

            if ((noiseVal < -1.0D || noiseVal > 2.0D) && _type == BiomeHillType.Mutated)
            {
                _topBlock    = BlockStates.Gravel();
                _fillerBlock = BlockStates.Gravel();
            }
            else if (noiseVal > 0.0D && _type != BiomeHillType.ExtraTrees)
            {
                _topBlock    = BlockStates.Stone();
                _fillerBlock = BlockStates.Stone();
            }

            base.GenerateBiomeTerrain(seaLevel, rand, chunk, chunk_x, chunk_z, x_in_chunk, z_in_chunk, noiseVal);
        }
Example #13
0
        public static async Task <bool> CanBlockStay(this BlockState state, IWorld world, IGrainFactory grainFactory, int x, int y, int z)
        {
            if (state.IsSameId(BlockStates.Grass()))
            {
                if (y > 0)
                {
                    var downState = await world.GetBlockState(grainFactory, x, y - 1, z);

                    if (downState == BlockStates.Dirt() ||
                        downState == BlockStates.Grass())
                    {
                        return(true);
                    }
                }

                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #14
0
        public override Task OnActivateAsync()
        {
            if (this.GetPrimaryKeyLong() == (long)BiomeId.Ocean)
            {
                BiomeProperties.BaseHeight      = -1.0f;
                BiomeProperties.HeightVariation = 0.1f;
                BiomeProperties.Temperature     = 0.5f;
                BiomeProperties.Rainfall        = 0.5f;
                BiomeProperties.EnableSnow      = false;
            }
            else if (this.GetPrimaryKeyLong() == (long)BiomeId.FrozenOcean)
            {
                BiomeProperties.BaseHeight      = -1.0f;
                BiomeProperties.HeightVariation = 0.1f;
                BiomeProperties.Temperature     = 0.0f;
                BiomeProperties.Rainfall        = 0.5f;
                BiomeProperties.EnableSnow      = true;
            }
            else if (this.GetPrimaryKeyLong() == (long)BiomeId.DeepOcean)
            {
                BiomeProperties.BaseHeight      = -1.8f;
                BiomeProperties.HeightVariation = 0.1f;
                BiomeProperties.Temperature     = 0.5f;
                BiomeProperties.Rainfall        = 0.5f;
                BiomeProperties.EnableSnow      = false;
            }

            TopBlock    = BlockStates.Dirt();
            FillerBlock = BlockStates.Dirt();

            MonsterList.Add(MobType.Creeper);
            MonsterList.Add(MobType.Skeleton);
            MonsterList.Add(MobType.Zombie);
            MonsterList.Add(MobType.Spider);

            return(Task.CompletedTask);
        }