| 1 | package net.minecraft.world.biome;
|
| 2 |
|
| 3 | import java.util.Random;
|
| 4 | import net.minecraft.block.BlockDoublePlant;
|
| 5 | import net.minecraft.block.BlockFlower;
|
| 6 | import net.minecraft.entity.passive.EntityWolf;
|
| 7 | import net.minecraft.util.BlockPos;
|
| 8 | import net.minecraft.util.MathHelper;
|
| 9 | import net.minecraft.world.World;
|
| 10 | import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
| 11 | import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
| 12 | import net.minecraft.world.gen.feature.WorldGenCanopyTree;
|
| 13 | import net.minecraft.world.gen.feature.WorldGenForest;
|
| 14 |
|
| 15 | public class BiomeGenForest extends BiomeGenBase
|
| 16 | {
|
| 17 | private int field_150632_aF;
|
| 18 | protected static final WorldGenForest field_150629_aC = new WorldGenForest(false, true);
|
| 19 | protected static final WorldGenForest field_150630_aD = new WorldGenForest(false, false);
|
| 20 | protected static final WorldGenCanopyTree field_150631_aE = new WorldGenCanopyTree(false);
|
| 21 |
|
| 22 | public BiomeGenForest(int id, int p_i45377_2_)
|
| 23 | {
|
| 24 | super(id);
|
| 25 | this.field_150632_aF = p_i45377_2_;
|
| 26 | this.theBiomeDecorator.treesPerChunk = 10;
|
| 27 | this.theBiomeDecorator.grassPerChunk = 2;
|
| 28 |
|
| 29 | if (this.field_150632_aF == 1)
|
| 30 | {
|
| 31 | this.theBiomeDecorator.treesPerChunk = 6;
|
| 32 | this.theBiomeDecorator.flowersPerChunk = 100;
|
| 33 | this.theBiomeDecorator.grassPerChunk = 1;
|
| 34 | }
|
| 35 |
|
| 36 | this.setFillerBlockMetadata(5159473);
|
| 37 | this.setTemperatureRainfall(0.7F, 0.8F);
|
| 38 |
|
| 39 | if (this.field_150632_aF == 2)
|
| 40 | {
|
| 41 | this.field_150609_ah = 353825;
|
| 42 | this.color = 3175492;
|
| 43 | this.setTemperatureRainfall(0.6F, 0.6F);
|
| 44 | }
|
| 45 |
|
| 46 | if (this.field_150632_aF == 0)
|
| 47 | {
|
| 48 | this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4));
|
| 49 | }
|
| 50 |
|
| 51 | if (this.field_150632_aF == 3)
|
| 52 | {
|
| 53 | this.theBiomeDecorator.treesPerChunk = -999;
|
| 54 | }
|
| 55 | }
|
| 56 |
|
| 57 | protected BiomeGenBase func_150557_a(int colorIn, boolean p_150557_2_)
|
| 58 | {
|
| 59 | if (this.field_150632_aF == 2)
|
| 60 | {
|
| 61 | this.field_150609_ah = 353825;
|
| 62 | this.color = colorIn;
|
| 63 |
|
| 64 | if (p_150557_2_)
|
| 65 | {
|
| 66 | this.field_150609_ah = (this.field_150609_ah & 16711422) >> 1;
|
| 67 | }
|
| 68 |
|
| 69 | return this;
|
| 70 | }
|
| 71 | else
|
| 72 | {
|
| 73 | return super.func_150557_a(colorIn, p_150557_2_);
|
| 74 | }
|
| 75 | }
|
| 76 |
|
| 77 | public WorldGenAbstractTree genBigTreeChance(Random rand)
|
| 78 | {
|
| 79 | return (WorldGenAbstractTree)(this.field_150632_aF == 3 && rand.nextInt(3) > 0 ? field_150631_aE : (this.field_150632_aF != 2 && rand.nextInt(5) != 0 ? this.worldGeneratorTrees : field_150630_aD));
|
| 80 | }
|
| 81 |
|
| 82 | public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
|
| 83 | {
|
| 84 | if (this.field_150632_aF == 1)
|
| 85 | {
|
| 86 | double d0 = MathHelper.clamp_double((1.0D + GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
|
| 87 | BlockFlower.EnumFlowerType blockflower$enumflowertype = BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)];
|
| 88 | return blockflower$enumflowertype == BlockFlower.EnumFlowerType.BLUE_ORCHID ? BlockFlower.EnumFlowerType.POPPY : blockflower$enumflowertype;
|
| 89 | }
|
| 90 | else
|
| 91 | {
|
| 92 | return super.pickRandomFlower(rand, pos);
|
| 93 | }
|
| 94 | }
|
| 95 |
|
| 96 | public void decorate(World worldIn, Random rand, BlockPos pos)
|
| 97 | {
|
| 98 | if (this.field_150632_aF == 3)
|
| 99 | {
|
| 100 | for (int i = 0; i < 4; ++i)
|
| 101 | {
|
| 102 | for (int j = 0; j < 4; ++j)
|
| 103 | {
|
| 104 | int k = i * 4 + 1 + 8 + rand.nextInt(3);
|
| 105 | int l = j * 4 + 1 + 8 + rand.nextInt(3);
|
| 106 | BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
|
| 107 |
|
| 108 | if (rand.nextInt(20) == 0)
|
| 109 | {
|
| 110 | WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom();
|
| 111 | worldgenbigmushroom.generate(worldIn, rand, blockpos);
|
| 112 | }
|
| 113 | else
|
| 114 | {
|
| 115 | WorldGenAbstractTree worldgenabstracttree = this.genBigTreeChance(rand);
|
| 116 | worldgenabstracttree.func_175904_e();
|
| 117 |
|
| 118 | if (worldgenabstracttree.generate(worldIn, rand, blockpos))
|
| 119 | {
|
| 120 | worldgenabstracttree.func_180711_a(worldIn, rand, blockpos);
|
| 121 | }
|
| 122 | }
|
| 123 | }
|
| 124 | }
|
| 125 | }
|
| 126 |
|
| 127 | int j1 = rand.nextInt(5) - 3;
|
| 128 |
|
| 129 | if (this.field_150632_aF == 1)
|
| 130 | {
|
| 131 | j1 += 2;
|
| 132 | }
|
| 133 |
|
| 134 | for (int k1 = 0; k1 < j1; ++k1)
|
| 135 | {
|
| 136 | int l1 = rand.nextInt(3);
|
| 137 |
|
| 138 | if (l1 == 0)
|
| 139 | {
|
| 140 | DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.SYRINGA);
|
| 141 | }
|
| 142 | else if (l1 == 1)
|
| 143 | {
|
| 144 | DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.ROSE);
|
| 145 | }
|
| 146 | else if (l1 == 2)
|
| 147 | {
|
| 148 | DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.PAEONIA);
|
| 149 | }
|
| 150 |
|
| 151 | for (int i2 = 0; i2 < 5; ++i2)
|
| 152 | {
|
| 153 | int j2 = rand.nextInt(16) + 8;
|
| 154 | int k2 = rand.nextInt(16) + 8;
|
| 155 | int i1 = rand.nextInt(worldIn.getHeight(pos.add(j2, 0, k2)).getY() + 32);
|
| 156 |
|
| 157 | if (DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, new BlockPos(pos.getX() + j2, i1, pos.getZ() + k2)))
|
| 158 | {
|
| 159 | break;
|
| 160 | }
|
| 161 | }
|
| 162 | }
|
| 163 |
|
| 164 | super.decorate(worldIn, rand, pos);
|
| 165 | }
|
| 166 |
|
| 167 | public int getGrassColorAtPos(BlockPos pos)
|
| 168 | {
|
| 169 | int i = super.getGrassColorAtPos(pos);
|
| 170 | return this.field_150632_aF == 3 ? (i & 16711422) + 2634762 >> 1 : i;
|
| 171 | }
|
| 172 |
|
| 173 | protected BiomeGenBase createMutatedBiome(final int p_180277_1_)
|
| 174 | {
|
| 175 | if (this.biomeID == BiomeGenBase.forest.biomeID)
|
| 176 | {
|
| 177 | BiomeGenForest biomegenforest = new BiomeGenForest(p_180277_1_, 1);
|
| 178 | biomegenforest.setHeight(new BiomeGenBase.Height(this.minHeight, this.maxHeight + 0.2F));
|
| 179 | biomegenforest.setBiomeName("Flower Forest");
|
| 180 | biomegenforest.func_150557_a(6976549, true);
|
| 181 | biomegenforest.setFillerBlockMetadata(8233509);
|
| 182 | return biomegenforest;
|
| 183 | }
|
| 184 | else
|
| 185 | {
|
| 186 | return this.biomeID != BiomeGenBase.birchForest.biomeID && this.biomeID != BiomeGenBase.birchForestHills.biomeID ? new BiomeGenMutated(p_180277_1_, this)
|
| 187 | {
|
| 188 | public void decorate(World worldIn, Random rand, BlockPos pos)
|
| 189 | {
|
| 190 | this.baseBiome.decorate(worldIn, rand, pos);
|
| 191 | }
|
| 192 | }: new BiomeGenMutated(p_180277_1_, this)
|
| 193 | {
|
| 194 | public WorldGenAbstractTree genBigTreeChance(Random rand)
|
| 195 | {
|
| 196 | return rand.nextBoolean() ? BiomeGenForest.field_150629_aC : BiomeGenForest.field_150630_aD;
|
| 197 | }
|
| 198 | };
|
| 199 | }
|
| 200 | }
|
| 201 | }
|
| 202 |
|