Add hide-land option for Underwater view shader (default = true)

This commit is contained in:
Mike Primm 2018-09-05 19:03:29 -05:00
parent 776d351ab2
commit 4afef4503a
2 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.MapIterator;
public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
private boolean hide_land = true;
class UnderwaterShaderState extends TexturePackHDShader.ShaderState {
private boolean ready;
@ -19,7 +20,7 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
@Override
public void reset(HDPerspectiveState ps) {
super.reset(ps);
ready = false;
ready = (!hide_land); // Start ready if not hiding land
}
/**
* Process next ray step - called for each block on route
@ -30,12 +31,14 @@ public class TexturePackHDUnderwaterShader extends TexturePackHDShader {
if (bs.isWater() || bs.isWaterlogged()) {
ready = true;
this.lastblk = full_water;
this.lastblkhit = full_water;
}
return ready ? super.processBlock(ps) : false;
}
}
public TexturePackHDUnderwaterShader(DynmapCore core, ConfigurationNode configuration) {
super(core, configuration);
hide_land = configuration.getBoolean("hide-land", true);
}
@Override
public HDShaderState getStateInstance(HDMap map, MapChunkCache cache, MapIterator mapiter, int scale) {

View File

@ -80,6 +80,12 @@ shaders:
- class: org.dynmap.hdmap.TexturePackHDUnderwaterShader
name: stdtexture-underwater
texturepack: standard
# Standard texture underwater view shader (with land not hidden)
- class: org.dynmap.hdmap.TexturePackHDUnderwaterShader
name: stdtexture-underwater-keep-land
texturepack: standard
hide-land: false
# Texture pack based shader for standard Minecraft textures, without biome-tinted grass/leaves
- class: org.dynmap.hdmap.TexturePackHDShader