HeightFilter implements Filter { @Override public int getLevel(int x, int y, int z, int inputLevel) { if ((z < start) || (z > end)) { return 0; } else if (z < fullStart) { return inputLevel - (fullStart - z) * inputLevel / (fullStart - start + 1); } else if (z <= fullEnd) { return inputLevel; } else { return inputLevel - (z - fullEnd) * inputLevel / (end - fullEnd + 1); } } HeightFilter(int maxHeight, int startHeight, int stopHeight, boolean feather); @Override int getLevel(int x, int y, int z, int inputLevel); int getStartHeight(); int getStopHeight(); boolean isFeather();  }
@Test public void testGetLevel() { HeightFilter filter = new HeightFilter(32, 10, 20, true); for (int z = 0; z < 32; z++) { System.out.printf("Level %3d: %2d%n", z, filter.getLevel(0, 0, z, 15)); } filter = new HeightFilter(32, 0, 31, false); for (int z = 0; z < 32; z++) { System.out.printf("Level %3d: %2d%n", z, filter.getLevel(0, 0, z, 15)); } filter = new HeightFilter(32, 10, 20, false); for (int z = 0; z < 32; z++) { System.out.printf("Level %3d: %2d%n", z, filter.getLevel(0, 0, z, 15)); } }