BiomeGenPlains .java

net.minecraft.world.biome.BiomeGenPlains (class, 110 lines): members: field_150628_aC, pickRandomFlower, createMutatedBiome, decorate. imports: World.

net.minecraft.world.biomeclass110 linescommonextends BiomeGenBase3.6 KB

API Surface (3)

BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
void decorate(World worldIn, Random rand, BlockPos pos)
BiomeGenBase createMutatedBiome(int p_180277_1_)

Fields & Constants (1)

field_150628_aC

String literals (1)

"Sunflower Plains"

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BiomeGenPlains.java110 lines · MCP 1.8.9 · verbatimOriginal ↗
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.EntityHorse;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.world.World;
9
10
public class BiomeGenPlains extends BiomeGenBase
11
{
12
    protected boolean field_150628_aC;
13
14
    protected BiomeGenPlains(int id)
15
    {
16
        super(id);
17
        this.setTemperatureRainfall(0.8F, 0.4F);
18
        this.setHeight(height_LowPlains);
19
        this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 6));
20
        this.theBiomeDecorator.treesPerChunk = -999;
21
        this.theBiomeDecorator.flowersPerChunk = 4;
22
        this.theBiomeDecorator.grassPerChunk = 10;
23
    }
24
25
    public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
26
    {
27
        double d0 = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
28
29
        if (d0 < -0.8D)
30
        {
31
            int j = rand.nextInt(4);
32
33
            switch (j)
34
            {
35
                case 0:
36
                    return BlockFlower.EnumFlowerType.ORANGE_TULIP;
37
38
                case 1:
39
                    return BlockFlower.EnumFlowerType.RED_TULIP;
40
41
                case 2:
42
                    return BlockFlower.EnumFlowerType.PINK_TULIP;
43
44
                case 3:
45
                default:
46
                    return BlockFlower.EnumFlowerType.WHITE_TULIP;
47
            }
48
        }
49
        else if (rand.nextInt(3) > 0)
50
        {
51
            int i = rand.nextInt(3);
52
            return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
53
        }
54
        else
55
        {
56
            return BlockFlower.EnumFlowerType.DANDELION;
57
        }
58
    }
59
60
    public void decorate(World worldIn, Random rand, BlockPos pos)
61
    {
62
        double d0 = GRASS_COLOR_NOISE.func_151601_a((double)(pos.getX() + 8) / 200.0D, (double)(pos.getZ() + 8) / 200.0D);
63
64
        if (d0 < -0.8D)
65
        {
66
            this.theBiomeDecorator.flowersPerChunk = 15;
67
            this.theBiomeDecorator.grassPerChunk = 5;
68
        }
69
        else
70
        {
71
            this.theBiomeDecorator.flowersPerChunk = 4;
72
            this.theBiomeDecorator.grassPerChunk = 10;
73
            DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.GRASS);
74
75
            for (int i = 0; i < 7; ++i)
76
            {
77
                int j = rand.nextInt(16) + 8;
78
                int k = rand.nextInt(16) + 8;
79
                int l = rand.nextInt(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32);
80
                DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j, l, k));
81
            }
82
        }
83
84
        if (this.field_150628_aC)
85
        {
86
            DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.SUNFLOWER);
87
88
            for (int i1 = 0; i1 < 10; ++i1)
89
            {
90
                int j1 = rand.nextInt(16) + 8;
91
                int k1 = rand.nextInt(16) + 8;
92
                int l1 = rand.nextInt(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32);
93
                DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j1, l1, k1));
94
            }
95
        }
96
97
        super.decorate(worldIn, rand, pos);
98
    }
99
100
    protected BiomeGenBase createMutatedBiome(int p_180277_1_)
101
    {
102
        BiomeGenPlains biomegenplains = new BiomeGenPlains(p_180277_1_);
103
        biomegenplains.setBiomeName("Sunflower Plains");
104
        biomegenplains.field_150628_aC = true;
105
        biomegenplains.setColor(9286496);
106
        biomegenplains.field_150609_ah = 14273354;
107
        return biomegenplains;
108
    }
109
}
110

Deobfuscated MCP 1.8.9 source of BiomeGenPlains from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/biome/BiomeGenPlains.java), stored verbatim.