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); }
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); } }
public static bool IsSoil(BlockState state) { if (state == BlockStates.Dirt() || state == BlockStates.GrassBlock()) { return(true); } else { return(false); } }
public override async Task GenerateSingle(IWorld world, ChunkWorldPos chunkWorldPos, BlockWorldPos pos) { // TODO use block accessor var curBlock = await GetBlock(world, chunkWorldPos, pos); var downBlock = await GetBlock(world, chunkWorldPos, new BlockWorldPos { X = pos.X, Y = pos.Y - 1, Z = pos.Z }); if (curBlock.IsAir() && downBlock == BlockStates.GrassBlock()) { await SetBlock(world, chunkWorldPos, pos, BlockStates.Grass()); } }
public override void Generate(IWorld world, IGrainFactory grainFactory, ChunkColumnCompactStorage chunk, Biome biome, Random random, BlockWorldPos pos) { BlockChunkPos chunkPos = pos.ToBlockChunkPos(); int x = chunkPos.X; int y = chunkPos.Y; int z = chunkPos.Z; // TODO use block accessor if (chunk[x, y, z].IsAir() && chunk[x, y - 1, z] == BlockStates.GrassBlock()) { chunk[x, y, z] = BlockStates.Grass(GrassType.TallGrass); } }
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()); } }
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); }
public BlockGrassBlock() { 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.GrassBlock(); UnlocalizedName = "grass"; }
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); }
public override async Task GenerateSingle(IWorld world, ChunkWorldPos chunkWorldPos, BlockWorldPos pos) { var curBlock = await GetBlock(world, chunkWorldPos, pos); var downBlock = await GetBlock(world, chunkWorldPos, new BlockWorldPos { X = pos.X, Y = pos.Y - 1, Z = pos.Z }); if (curBlock.IsAir() && downBlock == BlockStates.GrassBlock()) { switch (_flowerType) { case PlantsType.Poppy: await SetBlock(world, chunkWorldPos, pos, BlockStates.Poppy()); break; case PlantsType.Dandelion: await SetBlock(world, chunkWorldPos, pos, BlockStates.Dandelion()); break; } } }
public override void Generate(IWorld world, IGrainFactory grainFactory, ChunkColumnCompactStorage chunk, Biome biome, Random random, BlockWorldPos pos) { BlockChunkPos chunkPos = pos.ToBlockChunkPos(); int x = chunkPos.X; int y = chunkPos.Y; int z = chunkPos.Z; // TODO use block accessor if (chunk[x, y, z].IsAir() && chunk[x, y - 1, z] == BlockStates.GrassBlock()) { var flowerType = biome.GetRandomFlower(random); switch (flowerType) { case PlantsType.Poppy: chunk[x, y, z] = BlockStates.Poppy(); break; case PlantsType.Dandelion: chunk[x, y, z] = BlockStates.Dandelion(); break; } } }