Add 'waterbiomeshaded' option to control water biome shading

This commit is contained in:
Mike Primm 2011-10-04 22:05:47 -05:00
parent e0752eba5b
commit ded2fa815c
5 changed files with 17 additions and 3 deletions

View File

@ -84,6 +84,7 @@ public class DynmapPlugin extends JavaPlugin {
public Events events = new Events(); public Events events = new Events();
public String deftemplatesuffix = ""; public String deftemplatesuffix = "";
boolean swampshading = false; boolean swampshading = false;
boolean waterbiomeshading = false;
boolean fencejoin = false; boolean fencejoin = false;
/* Flag to let code know that we're doing reload - make sure we don't double-register event handlers */ /* Flag to let code know that we're doing reload - make sure we don't double-register event handlers */
@ -253,6 +254,8 @@ public class DynmapPlugin extends JavaPlugin {
deftemplatesuffix = configuration.getString("deftemplatesuffix", ""); deftemplatesuffix = configuration.getString("deftemplatesuffix", "");
/* Default swamp shading off for 1.8, on after */ /* Default swamp shading off for 1.8, on after */
swampshading = configuration.getBoolean("swampshaded", !getServer().getVersion().contains("(MC: 1.8")); swampshading = configuration.getBoolean("swampshaded", !getServer().getVersion().contains("(MC: 1.8"));
/* Default water biome shading off for 1.8, on after */
waterbiomeshading = configuration.getBoolean("waterbiomeshaded", !getServer().getVersion().contains("(MC: 1.8"));
/* Default fence-to-block-join off for 1.8, on after */ /* Default fence-to-block-join off for 1.8, on after */
fencejoin = configuration.getBoolean("fence-to-block-join", !getServer().getVersion().contains("(MC: 1.8")); fencejoin = configuration.getBoolean("fence-to-block-join", !getServer().getVersion().contains("(MC: 1.8"));

View File

@ -1145,6 +1145,10 @@ public class MapManager {
return plug_in.swampshading; return plug_in.swampshading;
} }
public boolean getWaterBiomeShading() {
return plug_in.waterbiomeshading;
}
public boolean getFenceJoin() { public boolean getFenceJoin() {
return plug_in.fencejoin; return plug_in.fencejoin;
} }

View File

@ -863,7 +863,7 @@ public class TexturePack {
* Read color for given subblock coordinate, with given block id and data and face * Read color for given subblock coordinate, with given block id and data and face
*/ */
public final void readColor(final HDPerspectiveState ps, final MapIterator mapiter, final Color rslt, final int blkid, final int lastblocktype, public final void readColor(final HDPerspectiveState ps, final MapIterator mapiter, final Color rslt, final int blkid, final int lastblocktype,
final boolean biome_shaded, final boolean swamp_shaded) { final boolean biome_shaded, final boolean swamp_shaded, final boolean water_shaded) {
int blkdata = ps.getBlockData(); int blkdata = ps.getBlockData();
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata, ps.getBlockRenderData()); HDTextureMap map = HDTextureMap.getMap(blkid, blkdata, ps.getBlockRenderData());
BlockStep laststep = ps.getLastBlockStep(); BlockStep laststep = ps.getLastBlockStep();
@ -1014,7 +1014,8 @@ public class TexturePack {
li = imgs[IMG_FOLIAGECOLOR]; li = imgs[IMG_FOLIAGECOLOR];
break; break;
case COLORMOD_WATERTONED: case COLORMOD_WATERTONED:
li = imgs[IMG_WATERCOLOR]; if(water_shaded)
li = imgs[IMG_WATERCOLOR];
break; break;
} }
if(li != null) { if(li != null) {

View File

@ -17,6 +17,7 @@ public class TexturePackHDShader implements HDShader {
private TexturePack tp; private TexturePack tp;
private boolean biome_shaded; private boolean biome_shaded;
private boolean swamp_shaded; private boolean swamp_shaded;
private boolean waterbiomeshaded;
public TexturePackHDShader(ConfigurationNode configuration) { public TexturePackHDShader(ConfigurationNode configuration) {
tpname = configuration.getString("texturepack", "minecraft"); tpname = configuration.getString("texturepack", "minecraft");
@ -24,6 +25,7 @@ public class TexturePackHDShader implements HDShader {
tp = TexturePack.getTexturePack(tpname); tp = TexturePack.getTexturePack(tpname);
biome_shaded = configuration.getBoolean("biomeshaded", true); biome_shaded = configuration.getBoolean("biomeshaded", true);
swamp_shaded = configuration.getBoolean("swampshaded", MapManager.mapman.getSwampShading()); swamp_shaded = configuration.getBoolean("swampshaded", MapManager.mapman.getSwampShading());
waterbiomeshaded = configuration.getBoolean("waterbiomeshaded", MapManager.mapman.getWaterBiomeShading());
if(tp == null) { if(tp == null) {
Log.severe("Error: shader '" + name + "' cannot load texture pack '" + tpname + "'"); Log.severe("Error: shader '" + name + "' cannot load texture pack '" + tpname + "'");
} }
@ -75,6 +77,7 @@ public class TexturePackHDShader implements HDShader {
private int lastblkid; private int lastblkid;
private boolean do_biome_shading; private boolean do_biome_shading;
private boolean do_swamp_shading; private boolean do_swamp_shading;
private boolean do_water_shading;
private OurShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) { private OurShaderState(MapIterator mapiter, HDMap map, MapChunkCache cache) {
this.mapiter = mapiter; this.mapiter = mapiter;
@ -93,6 +96,7 @@ public class TexturePackHDShader implements HDShader {
/* Biome raw data only works on normal worlds at this point */ /* Biome raw data only works on normal worlds at this point */
do_biome_shading = biome_shaded && (cache.getWorld().getEnvironment() == Environment.NORMAL); do_biome_shading = biome_shaded && (cache.getWorld().getEnvironment() == Environment.NORMAL);
do_swamp_shading = do_biome_shading && swamp_shaded; do_swamp_shading = do_biome_shading && swamp_shaded;
do_water_shading = do_biome_shading && waterbiomeshaded;
} }
/** /**
* Get our shader * Get our shader
@ -138,7 +142,7 @@ public class TexturePackHDShader implements HDShader {
} }
/* Get color from textures */ /* Get color from textures */
scaledtp.readColor(ps, mapiter, c, blocktype, lastblocktype, do_biome_shading, do_swamp_shading); scaledtp.readColor(ps, mapiter, c, blocktype, lastblocktype, do_biome_shading, do_swamp_shading, do_water_shading);
if (c.getAlpha() > 0) { if (c.getAlpha() > 0) {
int subalpha = ps.getSubmodelAlpha(); int subalpha = ps.getSubmodelAlpha();

View File

@ -251,6 +251,8 @@ enabletilehash: true
# Optional - control darkening of biome-shaded colors in swamp biomes (1.9+) - default is true for 1.9+, false for 1.8.x # Optional - control darkening of biome-shaded colors in swamp biomes (1.9+) - default is true for 1.9+, false for 1.8.x
#swampshaded: false #swampshaded: false
# Optional - control biome shading of water (1.9+) - default is true for 1.9+, false for 1.8.x
#waterbiomeshaded: false
# Optional - hide ores: render as normal stone (so that they aren't revealed by maps) # Optional - hide ores: render as normal stone (so that they aren't revealed by maps)
#hideores: true #hideores: true