| 1 | package net.minecraft.world.biome;
|
| 2 |
|
| 3 | import java.util.Random;
|
| 4 | import net.minecraft.block.BlockDirt;
|
| 5 | import net.minecraft.block.BlockDoublePlant;
|
| 6 | import net.minecraft.entity.passive.EntityHorse;
|
| 7 | import net.minecraft.init.Blocks;
|
| 8 | import net.minecraft.util.BlockPos;
|
| 9 | import net.minecraft.world.World;
|
| 10 | import net.minecraft.world.chunk.ChunkPrimer;
|
| 11 | import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
| 12 | import net.minecraft.world.gen.feature.WorldGenSavannaTree;
|
| 13 |
|
| 14 | public class BiomeGenSavanna extends BiomeGenBase
|
| 15 | {
|
| 16 | private static final WorldGenSavannaTree field_150627_aC = new WorldGenSavannaTree(false);
|
| 17 |
|
| 18 | protected BiomeGenSavanna(int id)
|
| 19 | {
|
| 20 | super(id);
|
| 21 | this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 1, 2, 6));
|
| 22 | this.theBiomeDecorator.treesPerChunk = 1;
|
| 23 | this.theBiomeDecorator.flowersPerChunk = 4;
|
| 24 | this.theBiomeDecorator.grassPerChunk = 20;
|
| 25 | }
|
| 26 |
|
| 27 | public WorldGenAbstractTree genBigTreeChance(Random rand)
|
| 28 | {
|
| 29 | return (WorldGenAbstractTree)(rand.nextInt(5) > 0 ? field_150627_aC : this.worldGeneratorTrees);
|
| 30 | }
|
| 31 |
|
| 32 | protected BiomeGenBase createMutatedBiome(int p_180277_1_)
|
| 33 | {
|
| 34 | BiomeGenBase biomegenbase = new BiomeGenSavanna.Mutated(p_180277_1_, this);
|
| 35 | biomegenbase.temperature = (this.temperature + 1.0F) * 0.5F;
|
| 36 | biomegenbase.minHeight = this.minHeight * 0.5F + 0.3F;
|
| 37 | biomegenbase.maxHeight = this.maxHeight * 0.5F + 1.2F;
|
| 38 | return biomegenbase;
|
| 39 | }
|
| 40 |
|
| 41 | public void decorate(World worldIn, Random rand, BlockPos pos)
|
| 42 | {
|
| 43 | DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.GRASS);
|
| 44 |
|
| 45 | for (int i = 0; i < 7; ++i)
|
| 46 | {
|
| 47 | int j = rand.nextInt(16) + 8;
|
| 48 | int k = rand.nextInt(16) + 8;
|
| 49 | int l = rand.nextInt(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32);
|
| 50 | DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j, l, k));
|
| 51 | }
|
| 52 |
|
| 53 | super.decorate(worldIn, rand, pos);
|
| 54 | }
|
| 55 |
|
| 56 | public static class Mutated extends BiomeGenMutated
|
| 57 | {
|
| 58 | public Mutated(int p_i45382_1_, BiomeGenBase p_i45382_2_)
|
| 59 | {
|
| 60 | super(p_i45382_1_, p_i45382_2_);
|
| 61 | this.theBiomeDecorator.treesPerChunk = 2;
|
| 62 | this.theBiomeDecorator.flowersPerChunk = 2;
|
| 63 | this.theBiomeDecorator.grassPerChunk = 5;
|
| 64 | }
|
| 65 |
|
| 66 | public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
|
| 67 | {
|
| 68 | this.topBlock = Blocks.grass.getDefaultState();
|
| 69 | this.fillerBlock = Blocks.dirt.getDefaultState();
|
| 70 |
|
| 71 | if (noiseVal > 1.75D)
|
| 72 | {
|
| 73 | this.topBlock = Blocks.stone.getDefaultState();
|
| 74 | this.fillerBlock = Blocks.stone.getDefaultState();
|
| 75 | }
|
| 76 | else if (noiseVal > -0.5D)
|
| 77 | {
|
| 78 | this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
|
| 79 | }
|
| 80 |
|
| 81 | this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
|
| 82 | }
|
| 83 |
|
| 84 | public void decorate(World worldIn, Random rand, BlockPos pos)
|
| 85 | {
|
| 86 | this.theBiomeDecorator.decorate(worldIn, rand, this, pos);
|
| 87 | }
|
| 88 | }
|
| 89 | }
|
| 90 |
|