BiomeGenSwamp .java

net.minecraft.world.biome.BiomeGenSwamp (class): members: pickRandomFlower, getFoliageColorAtPos, getGrassColorAtPos, genTerrainBlocks, genBigTreeChance.

net.minecraft.world.biomeclass84 linescommonextends BiomeGenBase2.8 KB

API Surface (5)

WorldGenAbstractTree genBigTreeChance(Random rand)
int getGrassColorAtPos(BlockPos pos)
int getFoliageColorAtPos(BlockPos pos)
BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)

Full Source

BiomeGenSwamp.java84 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.biome;
2
3
import java.util.Random;
4
import net.minecraft.block.BlockFlower;
5
import net.minecraft.block.material.Material;
6
import net.minecraft.entity.monster.EntitySlime;
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
13
public class BiomeGenSwamp extends BiomeGenBase
14
{
15
    protected BiomeGenSwamp(int id)
16
    {
17
        super(id);
18
        this.theBiomeDecorator.treesPerChunk = 2;
19
        this.theBiomeDecorator.flowersPerChunk = 1;
20
        this.theBiomeDecorator.deadBushPerChunk = 1;
21
        this.theBiomeDecorator.mushroomsPerChunk = 8;
22
        this.theBiomeDecorator.reedsPerChunk = 10;
23
        this.theBiomeDecorator.clayPerChunk = 1;
24
        this.theBiomeDecorator.waterlilyPerChunk = 4;
25
        this.theBiomeDecorator.sandPerChunk2 = 0;
26
        this.theBiomeDecorator.sandPerChunk = 0;
27
        this.theBiomeDecorator.grassPerChunk = 5;
28
        this.waterColorMultiplier = 14745518;
29
        this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 1, 1, 1));
30
    }
31
32
    public WorldGenAbstractTree genBigTreeChance(Random rand)
33
    {
34
        return this.worldGeneratorSwamp;
35
    }
36
37
    public int getGrassColorAtPos(BlockPos pos)
38
    {
39
        double d0 = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D);
40
        return d0 < -0.1D ? 5011004 : 6975545;
41
    }
42
43
    public int getFoliageColorAtPos(BlockPos pos)
44
    {
45
        return 6975545;
46
    }
47
48
    public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
49
    {
50
        return BlockFlower.EnumFlowerType.BLUE_ORCHID;
51
    }
52
53
    public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
54
    {
55
        double d0 = GRASS_COLOR_NOISE.func_151601_a((double)x * 0.25D, (double)z * 0.25D);
56
57
        if (d0 > 0.0D)
58
        {
59
            int i = x & 15;
60
            int j = z & 15;
61
62
            for (int k = 255; k >= 0; --k)
63
            {
64
                if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air)
65
                {
66
                    if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water)
67
                    {
68
                        chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState());
69
70
                        if (d0 < 0.12D)
71
                        {
72
                            chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState());
73
                        }
74
                    }
75
76
                    break;
77
                }
78
            }
79
        }
80
81
        this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
82
    }
83
}
84

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