Update biomecolored to support biome-type-based,

biome-temperature-based and biome-rainfail-based shading
This commit is contained in:
Mike Primm 2011-06-20 16:00:28 -05:00
parent edf7d4f5c8
commit 6efbf3a3df
9 changed files with 288 additions and 71 deletions

View File

@ -227,16 +227,35 @@ Locked Chest
95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255
Trap Door Trap Door
96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255
[RAINFOREST] 0 153 0 255 0 138 0 255 0 153 0 255 0 107 0 255 Biome Rainforest - Dark Green
[SWAMPLAND] 0 166 186 255 0 149 167 255 0 166 186 255 0 116 130 255 [RAINFOREST] 49 67 21 255 39 53 17 255 24 34 10 255 19 27 8 255
[SEASONAL_FOREST] 0 189 84 255 0 170 76 255 0 189 84 255 0 132 59 255 Biome Swampland - Brown
[FOREST] 151 207 176 255 136 186 158 255 151 207 176 255 106 145 123 255 [SWAMPLAND] 75 44 24 255 60 35 19 255 37 22 12 255 30 18 10 255
[SAVANNA] 192 220 192 255 173 198 173 255 192 220 192 255 134 154 134 255 Biome Seasonal Forest - Light Green
[SHRUBLAND] 255 255 153 255 230 230 138 255 255 255 153 255 179 179 107 255 [SEASONAL_FOREST] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TAIGA] 71 150 69 255 64 135 62 255 71 150 69 255 50 105 48 255 Biome Forest - Light Gray
[DESERT] 225 217 159 255 203 195 143 255 225 217 159 255 158 152 111 255 [FOREST] 138 145 145 255 110 115 115 255 69 72 72 255 55 57 57 255
[PLAINS] 238 200 27 255 214 180 24 255 238 200 27 255 167 140 19 255 Biome Savanna - Dark Gray
[ICE_DESERT] 181 181 181 255 163 163 163 255 181 181 181 255 127 127 127 255 [SAVANNA] 58 58 58 255 47 47 47 255 29 29 29 255 23 23 23 255
[TUNDRA] 255 255 255 255 230 230 230 255 255 255 255 255 179 179 179 255 Biome Shrubland - Yellow
[HELL] 191 148 149 255 172 133 134 255 191 148 149 255 134 104 104 255 [SHRUBLAND] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
Biome Taiga - Cyan
[TAIGA] 34 102 131 255 27 81 104 255 17 51 65 255 13 40 52 255
Biome Desert - Orange
[DESERT] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
Biome Plains - Magenta
[PLAINS] 166 66 175 255 133 53 140 255 83 33 87 255 66 26 69 255
Biome Ice Desert - Blue
[ICE_DESERT] 34 44 134 255 27 35 107 255 17 22 67 255 13 18 53 255
Biome Tundra - White
[TUNDRA] 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255
Biome Hell - Pink
[HELL] 190 115 135 255 151 92 108 255 95 57 67 255 75 46 53 255
[RAINFALL-0.0] 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255
[RAINFALL-1.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.5] 91 121 185 255 73 96 147 255 46 61 92 255 36 48 73 255
[TEMPERATURE-0.8] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TEMPERATURE-0.9] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
[TEMPERATURE-0.95] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
[TEMPERATURE-1.0] 143 39 36 255 114 31 28 255 71 20 18 255 57 16 14 255

View File

@ -227,15 +227,35 @@ Locked Chest
95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255
Trap Door Trap Door
96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255
[RAINFOREST] 0 153 0 255 0 138 0 255 0 153 0 255 0 107 0 255 Biome Rainforest - Dark Green
[SWAMPLAND] 0 166 186 255 0 149 167 255 0 166 186 255 0 116 130 255 [RAINFOREST] 49 67 21 255 39 53 17 255 24 34 10 255 19 27 8 255
[SEASONAL_FOREST] 0 189 84 255 0 170 76 255 0 189 84 255 0 132 59 255 Biome Swampland - Brown
[FOREST] 151 207 176 255 136 186 158 255 151 207 176 255 106 145 123 255 [SWAMPLAND] 75 44 24 255 60 35 19 255 37 22 12 255 30 18 10 255
[SAVANNA] 192 220 192 255 173 198 173 255 192 220 192 255 134 154 134 255 Biome Seasonal Forest - Light Green
[SHRUBLAND] 255 255 153 255 230 230 138 255 255 255 153 255 179 179 107 255 [SEASONAL_FOREST] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TAIGA] 71 150 69 255 64 135 62 255 71 150 69 255 50 105 48 255 Biome Forest - Light Gray
[DESERT] 225 217 159 255 203 195 143 255 225 217 159 255 158 152 111 255 [FOREST] 138 145 145 255 110 115 115 255 69 72 72 255 55 57 57 255
[PLAINS] 238 200 27 255 214 180 24 255 238 200 27 255 167 140 19 255 Biome Savanna - Dark Gray
[ICE_DESERT] 181 181 181 255 163 163 163 255 181 181 181 255 127 127 127 255 [SAVANNA] 58 58 58 255 47 47 47 255 29 29 29 255 23 23 23 255
[TUNDRA] 255 255 255 255 230 230 230 255 255 255 255 255 179 179 179 255 Biome Shrubland - Yellow
[HELL] 191 148 149 255 172 133 134 255 191 148 149 255 134 104 104 255 [SHRUBLAND] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
Biome Taiga - Cyan
[TAIGA] 34 102 131 255 27 81 104 255 17 51 65 255 13 40 52 255
Biome Desert - Orange
[DESERT] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
Biome Plains - Magenta
[PLAINS] 166 66 175 255 133 53 140 255 83 33 87 255 66 26 69 255
Biome Ice Desert - Blue
[ICE_DESERT] 34 44 134 255 27 35 107 255 17 22 67 255 13 18 53 255
Biome Tundra - White
[TUNDRA] 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255
Biome Hell - Pink
[HELL] 190 115 135 255 151 92 108 255 95 57 67 255 75 46 53 255
[RAINFALL-0.0] 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255
[RAINFALL-1.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.5] 91 121 185 255 73 96 147 255 46 61 92 255 36 48 73 255
[TEMPERATURE-0.8] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TEMPERATURE-0.9] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
[TEMPERATURE-0.95] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
[TEMPERATURE-1.0] 143 39 36 255 114 31 28 255 71 20 18 255 57 16 14 255

View File

@ -227,16 +227,35 @@ Locked Chest
95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255
Trap Door Trap Door
96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255
[RAINFOREST] 0 153 0 255 0 138 0 255 0 153 0 255 0 107 0 255 Biome Rainforest - Dark Green
[SWAMPLAND] 0 166 186 255 0 149 167 255 0 166 186 255 0 116 130 255 [RAINFOREST] 49 67 21 255 39 53 17 255 24 34 10 255 19 27 8 255
[SEASONAL_FOREST] 0 189 84 255 0 170 76 255 0 189 84 255 0 132 59 255 Biome Swampland - Brown
[FOREST] 151 207 176 255 136 186 158 255 151 207 176 255 106 145 123 255 [SWAMPLAND] 75 44 24 255 60 35 19 255 37 22 12 255 30 18 10 255
[SAVANNA] 192 220 192 255 173 198 173 255 192 220 192 255 134 154 134 255 Biome Seasonal Forest - Light Green
[SHRUBLAND] 255 255 153 255 230 230 138 255 255 255 153 255 179 179 107 255 [SEASONAL_FOREST] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TAIGA] 71 150 69 255 64 135 62 255 71 150 69 255 50 105 48 255 Biome Forest - Light Gray
[DESERT] 225 217 159 255 203 195 143 255 225 217 159 255 158 152 111 255 [FOREST] 138 145 145 255 110 115 115 255 69 72 72 255 55 57 57 255
[PLAINS] 238 200 27 255 214 180 24 255 238 200 27 255 167 140 19 255 Biome Savanna - Dark Gray
[ICE_DESERT] 181 181 181 255 163 163 163 255 181 181 181 255 127 127 127 255 [SAVANNA] 58 58 58 255 47 47 47 255 29 29 29 255 23 23 23 255
[TUNDRA] 255 255 255 255 230 230 230 255 255 255 255 255 179 179 179 255 Biome Shrubland - Yellow
[HELL] 191 148 149 255 172 133 134 255 191 148 149 255 134 104 104 255 [SHRUBLAND] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
Biome Taiga - Cyan
[TAIGA] 34 102 131 255 27 81 104 255 17 51 65 255 13 40 52 255
Biome Desert - Orange
[DESERT] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
Biome Plains - Magenta
[PLAINS] 166 66 175 255 133 53 140 255 83 33 87 255 66 26 69 255
Biome Ice Desert - Blue
[ICE_DESERT] 34 44 134 255 27 35 107 255 17 22 67 255 13 18 53 255
Biome Tundra - White
[TUNDRA] 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255
Biome Hell - Pink
[HELL] 190 115 135 255 151 92 108 255 95 57 67 255 75 46 53 255
[RAINFALL-0.0] 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255
[RAINFALL-1.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.5] 91 121 185 255 73 96 147 255 46 61 92 255 36 48 73 255
[TEMPERATURE-0.8] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TEMPERATURE-0.9] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
[TEMPERATURE-0.95] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
[TEMPERATURE-1.0] 143 39 36 255 114 31 28 255 71 20 18 255 57 16 14 255

View File

@ -113,15 +113,35 @@
94 159 127 80 255 102 0 0 0 255 0 0 255 204 0 0 0 94 159 127 80 255 102 0 0 0 255 0 0 255 204 0 0 0
95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 95 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255
96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 96 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255
[RAINFOREST] 0 153 0 255 0 138 0 255 0 153 0 255 0 107 0 255 Biome Rainforest - Dark Green
[SWAMPLAND] 0 166 186 255 0 149 167 255 0 166 186 255 0 116 130 255 [RAINFOREST] 49 67 21 255 39 53 17 255 24 34 10 255 19 27 8 255
[SEASONAL_FOREST] 0 189 84 255 0 170 76 255 0 189 84 255 0 132 59 255 Biome Swampland - Brown
[FOREST] 151 207 176 255 136 186 158 255 151 207 176 255 106 145 123 255 [SWAMPLAND] 75 44 24 255 60 35 19 255 37 22 12 255 30 18 10 255
[SAVANNA] 192 220 192 255 173 198 173 255 192 220 192 255 134 154 134 255 Biome Seasonal Forest - Light Green
[SHRUBLAND] 255 255 153 255 230 230 138 255 255 255 153 255 179 179 107 255 [SEASONAL_FOREST] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TAIGA] 71 150 69 255 64 135 62 255 71 150 69 255 50 105 48 255 Biome Forest - Light Gray
[DESERT] 225 217 159 255 203 195 143 255 225 217 159 255 158 152 111 255 [FOREST] 138 145 145 255 110 115 115 255 69 72 72 255 55 57 57 255
[PLAINS] 238 200 27 255 214 180 24 255 238 200 27 255 167 140 19 255 Biome Savanna - Dark Gray
[ICE_DESERT] 181 181 181 255 163 163 163 255 181 181 181 255 127 127 127 255 [SAVANNA] 58 58 58 255 47 47 47 255 29 29 29 255 23 23 23 255
[TUNDRA] 255 255 255 255 230 230 230 255 255 255 255 255 179 179 179 255 Biome Shrubland - Yellow
[HELL] 191 148 149 255 172 133 134 255 191 148 149 255 134 104 104 255 [SHRUBLAND] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
Biome Taiga - Cyan
[TAIGA] 34 102 131 255 27 81 104 255 17 51 65 255 13 40 52 255
Biome Desert - Orange
[DESERT] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
Biome Plains - Magenta
[PLAINS] 166 66 175 255 133 53 140 255 83 33 87 255 66 26 69 255
Biome Ice Desert - Blue
[ICE_DESERT] 34 44 134 255 27 35 107 255 17 22 67 255 13 18 53 255
Biome Tundra - White
[TUNDRA] 222 222 222 255 177 177 177 255 111 111 111 255 88 88 88 255
Biome Hell - Pink
[HELL] 190 115 135 255 151 92 108 255 95 57 67 255 75 46 53 255
[RAINFALL-0.0] 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255
[RAINFALL-1.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255
[TEMPERATURE-0.5] 91 121 185 255 73 96 147 255 46 61 92 255 36 48 73 255
[TEMPERATURE-0.8] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255
[TEMPERATURE-0.9] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255
[TEMPERATURE-0.95] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255
[TEMPERATURE-1.0] 143 39 36 255 114 31 28 255 71 20 18 255 57 16 14 255

View File

@ -185,7 +185,8 @@ templates:
# prefix: b # prefix: b
# maximumheight: 127 # maximumheight: 127
# colorscheme: default # colorscheme: default
# biomecolored: true # # Biome-based coloring : biome=biome type, temperature=biome-temperature, rainfall=biome-rainfall
# biomecolored: biome
# - class: org.dynmap.kzedmap.HighlightTileRenderer # - class: org.dynmap.kzedmap.HighlightTileRenderer
# prefix: ht # prefix: ht
# maximumheight: 127 # maximumheight: 127

View File

@ -18,12 +18,16 @@ public class ColorScheme {
public final Color[][] colors; /* [blk-type][step] */ public final Color[][] colors; /* [blk-type][step] */
public final Color[][][] datacolors; /* [bkt-type][blk-dat][step] */ public final Color[][][] datacolors; /* [bkt-type][blk-dat][step] */
public final Color[][] biomecolors; /* [Biome.ordinal][step] */ public final Color[][] biomecolors; /* [Biome.ordinal][step] */
public final Color[][] raincolors; /* [rain * 63][step] */
public final Color[][] tempcolors; /* [temp * 63][step] */
public ColorScheme(String name, Color[][] colors, Color[][][] datacolors, Color[][] biomecolors) { public ColorScheme(String name, Color[][] colors, Color[][][] datacolors, Color[][] biomecolors, Color[][] raincolors, Color[][] tempcolors) {
this.name = name; this.name = name;
this.colors = colors; this.colors = colors;
this.datacolors = datacolors; this.datacolors = datacolors;
this.biomecolors = biomecolors; this.biomecolors = biomecolors;
this.raincolors = raincolors;
this.tempcolors = tempcolors;
} }
private static File getColorSchemeDirectory() { private static File getColorSchemeDirectory() {
@ -46,6 +50,9 @@ public class ColorScheme {
Color[][] colors = new Color[256][]; Color[][] colors = new Color[256][];
Color[][][] datacolors = new Color[256][][]; Color[][][] datacolors = new Color[256][][];
Color[][] biomecolors = new Color[Biome.values().length][]; Color[][] biomecolors = new Color[Biome.values().length][];
Color[][] raincolors = new Color[64][];
Color[][] tempcolors = new Color[64][];
InputStream stream; InputStream stream;
try { try {
Debug.debug("Loading colors from '" + colorSchemeFile + "'..."); Debug.debug("Loading colors from '" + colorSchemeFile + "'...");
@ -72,6 +79,8 @@ public class ColorScheme {
Integer id; Integer id;
Integer dat = null; Integer dat = null;
boolean isbiome = false; boolean isbiome = false;
boolean istemp = false;
boolean israin = false;
int idx = split[0].indexOf(':'); int idx = split[0].indexOf(':');
if(idx > 0) { /* ID:data - data color */ if(idx > 0) { /* ID:data - data color */
id = new Integer(split[0].substring(0, idx)); id = new Integer(split[0].substring(0, idx));
@ -89,6 +98,28 @@ public class ColorScheme {
break; break;
} }
} }
if(id < 0) { /* Not biome - check for rain or temp */
if(bio.startsWith("RAINFALL-")) {
try {
double v = Double.parseDouble(bio.substring(9));
if((v >= 0) && (v <= 1.00)) {
id = (int)(v * 63.0);
israin = true;
}
} catch (NumberFormatException nfx) {
}
}
else if(bio.startsWith("TEMPERATURE-")) {
try {
double v = Double.parseDouble(bio.substring(12));
if((v >= 0) && (v <= 1.00)) {
id = (int)(v * 63.0);
istemp = true;
}
} catch (NumberFormatException nfx) {
}
}
}
} }
else { else {
id = new Integer(split[0]); id = new Integer(split[0]);
@ -104,7 +135,13 @@ public class ColorScheme {
c[4] = new Color((c[0].getRed()+c[2].getRed())/2, (c[0].getGreen()+c[2].getGreen())/2, (c[0].getBlue()+c[2].getBlue())/2, (c[0].getAlpha()+c[2].getAlpha())/2); c[4] = new Color((c[0].getRed()+c[2].getRed())/2, (c[0].getGreen()+c[2].getGreen())/2, (c[0].getBlue()+c[2].getBlue())/2, (c[0].getAlpha()+c[2].getAlpha())/2);
if(isbiome) { if(isbiome) {
if((id >= 0) && (id < biomecolors.length)) if(istemp) {
tempcolors[id] = c;
}
else if(israin) {
raincolors[id] = c;
}
else if((id >= 0) && (id < biomecolors.length))
biomecolors[id] = c; biomecolors[id] = c;
} }
else if(dat != null) { else if(dat != null) {
@ -137,12 +174,65 @@ public class ColorScheme {
} }
} }
} }
/* And interpolate any missing rain and temperature colors */
interpolateColorTable(tempcolors);
interpolateColorTable(raincolors);
} catch (RuntimeException e) { } catch (RuntimeException e) {
Log.severe("Could not load colors '" + name + "' ('" + colorSchemeFile + "').", e); Log.severe("Could not load colors '" + name + "' ('" + colorSchemeFile + "').", e);
return null; return null;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.severe("Could not load colors '" + name + "' ('" + colorSchemeFile + "'): File not found.", e); Log.severe("Could not load colors '" + name + "' ('" + colorSchemeFile + "'): File not found.", e);
} }
return new ColorScheme(name, colors, datacolors, biomecolors); return new ColorScheme(name, colors, datacolors, biomecolors, raincolors, tempcolors);
}
public static void interpolateColorTable(Color[][] c) {
int idx = -1;
for(int k = 0; k < c.length; k++) {
if(c[k] == null) { /* Missing? */
if((idx >= 0) && (k == (c.length-1))) { /* We're last - so fill forward from last color */
for(int kk = idx+1; kk <= k; kk++) {
c[kk] = c[idx];
}
}
/* Skip - will backfill when we find next color */
}
else if(idx == -1) { /* No previous color, just backfill this color */
for(int kk = 0; kk < k; kk++) {
c[kk] = c[k];
}
idx = k; /* This is now last defined color */
}
else { /* Else, interpolate between last idx and this one */
int cnt = c[k].length;
for(int kk = idx+1; kk < k; kk++) {
double interp = (double)(kk-idx)/(double)(k-idx);
Color[] cc = new Color[cnt];
for(int jj = 0; jj < cnt; jj++) {
cc[jj] = new Color(
(int)((1.0-interp)*c[idx][jj].getRed() + interp*c[k][jj].getRed()),
(int)((1.0-interp)*c[idx][jj].getGreen() + interp*c[k][jj].getGreen()),
(int)((1.0-interp)*c[idx][jj].getBlue() + interp*c[k][jj].getBlue()),
(int)((1.0-interp)*c[idx][jj].getAlpha() + interp*c[k][jj].getAlpha()));
}
c[kk] = cc;
}
idx = k;
}
}
}
public Color[] getRainColor(double rain) {
int idx = (int)(rain * 63.0);
if((idx >= 0) && (idx < raincolors.length))
return raincolors[idx];
else
return null;
}
public Color[] getTempColor(double temp) {
int idx = (int)(temp * 63.0);
if((idx >= 0) && (idx < tempcolors.length))
return tempcolors[idx];
else
return null;
} }
} }

View File

@ -39,7 +39,10 @@ public class DefaultTileRenderer implements MapTileRenderer {
protected int lightscale[]; /* scale skylight level (light = lightscale[skylight] */ protected int lightscale[]; /* scale skylight level (light = lightscale[skylight] */
protected boolean night_and_day; /* If true, render both day (prefix+'-day') and night (prefix) tiles */ protected boolean night_and_day; /* If true, render both day (prefix+'-day') and night (prefix) tiles */
protected boolean transparency; /* Is transparency support active? */ protected boolean transparency; /* Is transparency support active? */
protected boolean biomecolored; /* Use biome for coloring */ public enum BiomeColorOption {
NONE, BIOME, TEMPERATURE, RAINFALL
}
protected BiomeColorOption biomecolored = BiomeColorOption.NONE; /* Use biome for coloring */
@Override @Override
public String getName() { public String getName() {
return name; return name;
@ -83,9 +86,24 @@ public class DefaultTileRenderer implements MapTileRenderer {
colorScheme = ColorScheme.getScheme((String)configuration.get("colorscheme")); colorScheme = ColorScheme.getScheme((String)configuration.get("colorscheme"));
night_and_day = configuration.getBoolean("night-and-day", false); night_and_day = configuration.getBoolean("night-and-day", false);
transparency = configuration.getBoolean("transparency", true); /* Default on */ transparency = configuration.getBoolean("transparency", true); /* Default on */
biomecolored = configuration.getBoolean("biomecolored", false); String biomeopt = configuration.getString("biomecolored", "none");
if(biomeopt.equals("biome")) {
biomecolored = BiomeColorOption.BIOME;
}
else if(biomeopt.equals("temperature")) {
biomecolored = BiomeColorOption.TEMPERATURE;
}
else if(biomeopt.equals("rainfall")) {
biomecolored = BiomeColorOption.RAINFALL;
}
else {
biomecolored = BiomeColorOption.NONE;
}
}
public boolean isBiomeDataNeeded() { return biomecolored.equals(BiomeColorOption.BIOME); }
public boolean isRawBiomeDataNeeded() {
return biomecolored.equals(BiomeColorOption.RAINFALL) || biomecolored.equals(BiomeColorOption.TEMPERATURE);
} }
public boolean isBiomeDataNeeded() { return biomecolored; }
public boolean render(MapChunkCache cache, KzedMapTile tile, File outputFile) { public boolean render(MapChunkCache cache, KzedMapTile tile, File outputFile) {
World world = tile.getWorld(); World world = tile.getWorld();
@ -365,6 +383,8 @@ public class DefaultTileRenderer implements MapTileRenderer {
int lightlevel = 15; int lightlevel = 15;
int lightlevel_day = 15; int lightlevel_day = 15;
Biome bio = null; Biome bio = null;
double rain = 0.0;
double temp = 0.0;
result.setTransparent(); result.setTransparent();
if(result_day != null) if(result_day != null)
result_day.setTransparent(); result_day.setTransparent();
@ -386,11 +406,22 @@ public class DefaultTileRenderer implements MapTileRenderer {
isnether = false; isnether = false;
} }
if(id != 0) { /* No update needed for air */ if(id != 0) { /* No update needed for air */
if(colorScheme.datacolors[id] != null) { /* If data colored */ switch(biomecolored) {
data = mapiter.getBlockData(); case NONE:
if(colorScheme.datacolors[id] != null) { /* If data colored */
data = mapiter.getBlockData();
}
break;
case BIOME:
bio = mapiter.getBiome();
break;
case RAINFALL:
rain = mapiter.getRawBiomeRainfall();
break;
case TEMPERATURE:
temp = mapiter.getRawBiomeTemperature();
break;
} }
if(biomecolored)
bio = mapiter.getBiome();
if((shadowscale != null) && (mapiter.getY() < 127)) { if((shadowscale != null) && (mapiter.getY() < 127)) {
/* Find light level of previous chunk */ /* Find light level of previous chunk */
switch(seq) { switch(seq) {
@ -448,17 +479,25 @@ public class DefaultTileRenderer implements MapTileRenderer {
result.setColor(highlightColor); result.setColor(highlightColor);
return; return;
} }
Color[] colors; Color[] colors = null;
if(biomecolored) { switch(biomecolored) {
if(bio != null) case NONE:
colors = colorScheme.biomecolors[bio.ordinal()]; if(data != 0)
else colors = colorScheme.datacolors[id][data];
colors = null; else
colors = colorScheme.colors[id];
break;
case BIOME:
if(bio != null)
colors = colorScheme.biomecolors[bio.ordinal()];
break;
case RAINFALL:
colors = colorScheme.getRainColor(rain);
break;
case TEMPERATURE:
colors = colorScheme.getTempColor(temp);
break;
} }
else if(data != 0)
colors = colorScheme.datacolors[id][data];
else
colors = colorScheme.colors[id];
if (colors != null) { if (colors != null) {
Color c = colors[seq]; Color c = colors[seq];
if (c.getAlpha() > 0) { if (c.getAlpha() > 0) {

View File

@ -318,6 +318,14 @@ public class KzedMap extends MapType {
return false; return false;
} }
public boolean isRawBiomeDataNeeded() {
for(MapTileRenderer r : renderers) {
if(r.isRawBiomeDataNeeded())
return true;
}
return false;
}
public String getName() { public String getName() {
return "KzedMap"; return "KzedMap";
} }

View File

@ -14,4 +14,5 @@ public interface MapTileRenderer {
void buildClientConfiguration(JSONObject worldObject); void buildClientConfiguration(JSONObject worldObject);
boolean isBiomeDataNeeded(); boolean isBiomeDataNeeded();
boolean isRawBiomeDataNeeded();
} }