/
GrassColorizerAlternate.java
55 lines (47 loc) · 1.5 KB
/
GrassColorizerAlternate.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.progwml6.natura.client.renderer;
import com.progwml6.natura.common.Natura;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GrassColorizerAlternate
{
/** Color buffer for grass */
private static int[] blueGrassBuffer = new int[65536];
private static int[] orangeGrassBuffer = new int[65536];
public static void setBlueGrassBiomeColorizer(int[] par0ArrayOfInteger)
{
if (par0ArrayOfInteger.length == 65536)
{
blueGrassBuffer = par0ArrayOfInteger;
}
else
{
Natura.logger.warn("Invalid texture for blue grass biome colors: expected 256x256 (65536) pixels, got {}!", par0ArrayOfInteger.length);
}
}
public static int getBlueGrassColor(double temperature, double humidity)
{
humidity *= temperature;
int i = (int) ((1.0D - temperature) * 255.0D);
int j = (int) ((1.0D - humidity) * 255.0D);
return blueGrassBuffer[j << 8 | i];
}
public static void setOrangeGrassBiomeColorizer(int[] par0ArrayOfInteger)
{
if (par0ArrayOfInteger.length == 65536)
{
orangeGrassBuffer = par0ArrayOfInteger;
}
else
{
Natura.logger.warn("Invalid texture for orange grass biome colors: expected 256x256 (65536) pixels, got {}!", par0ArrayOfInteger.length);
}
}
public static int getOrangeGrassColor(double temperature, double humidity)
{
humidity *= temperature;
int i = (int) ((1.0D - temperature) * 255.0D);
int j = (int) ((1.0D - humidity) * 255.0D);
return orangeGrassBuffer[j << 8 | i];
}
}