BiomeColorHelper .java

net.minecraft.world.biome.BiomeColorHelper (class): members: WATER_COLOR_MULTIPLIER, getWaterColorAtPos, ColorResolver, FOLIAGE_COLOR, GRASS_COLOR.

net.minecraft.world.biomeclass67 linescommon2.2 KB

API Surface (6)

int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
int getGrassColorAtPos(IBlockAccess p_180286_0_, BlockPos p_180286_1_)
int getFoliageColorAtPos(IBlockAccess p_180287_0_, BlockPos p_180287_1_)
int getWaterColorAtPos(IBlockAccess p_180288_0_, BlockPos p_180288_1_)

Fields & Constants (3)

GRASS_COLOR
FOLIAGE_COLOR
WATER_COLOR_MULTIPLIER

Code Graph: Dependencies (3)

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

Full Source

BiomeColorHelper.java67 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.biome;
2
3
import net.minecraft.util.BlockPos;
4
import net.minecraft.world.IBlockAccess;
5
6
public class BiomeColorHelper
7
{
8
    private static final BiomeColorHelper.ColorResolver GRASS_COLOR = new BiomeColorHelper.ColorResolver()
9
    {
10
        public int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
11
        {
12
            return biome.getGrassColorAtPos(blockPosition);
13
        }
14
    };
15
    private static final BiomeColorHelper.ColorResolver FOLIAGE_COLOR = new BiomeColorHelper.ColorResolver()
16
    {
17
        public int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
18
        {
19
            return biome.getFoliageColorAtPos(blockPosition);
20
        }
21
    };
22
    private static final BiomeColorHelper.ColorResolver WATER_COLOR_MULTIPLIER = new BiomeColorHelper.ColorResolver()
23
    {
24
        public int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition)
25
        {
26
            return biome.waterColorMultiplier;
27
        }
28
    };
29
30
    private static int getColorAtPos(IBlockAccess blockAccess, BlockPos pos, BiomeColorHelper.ColorResolver colorResolver)
31
    {
32
        int i = 0;
33
        int j = 0;
34
        int k = 0;
35
36
        for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-1, 0, -1), pos.add(1, 0, 1)))
37
        {
38
            int l = colorResolver.getColorAtPos(blockAccess.getBiomeGenForCoords(blockpos$mutableblockpos), blockpos$mutableblockpos);
39
            i += (l & 16711680) >> 16;
40
            j += (l & 65280) >> 8;
41
            k += l & 255;
42
        }
43
44
        return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255;
45
    }
46
47
    public static int getGrassColorAtPos(IBlockAccess p_180286_0_, BlockPos p_180286_1_)
48
    {
49
        return getColorAtPos(p_180286_0_, p_180286_1_, GRASS_COLOR);
50
    }
51
52
    public static int getFoliageColorAtPos(IBlockAccess p_180287_0_, BlockPos p_180287_1_)
53
    {
54
        return getColorAtPos(p_180287_0_, p_180287_1_, FOLIAGE_COLOR);
55
    }
56
57
    public static int getWaterColorAtPos(IBlockAccess p_180288_0_, BlockPos p_180288_1_)
58
    {
59
        return getColorAtPos(p_180288_0_, p_180288_1_, WATER_COLOR_MULTIPLIER);
60
    }
61
62
    interface ColorResolver
63
    {
64
        int getColorAtPos(BiomeGenBase biome, BlockPos blockPosition);
65
    }
66
}
67

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