cap height at 255

This commit is contained in:
Jesse Boyd 2016-05-02 12:09:21 +10:00
parent 9f0602f2ec
commit a7cc08a882

View File

@ -43,7 +43,7 @@ public class HeightBrush implements Brush {
int xx = pos.getBlockX(); int xx = pos.getBlockX();
int zz = pos.getBlockZ(); int zz = pos.getBlockZ();
int worldPointHeight = session.getHighestTerrainBlock(xx, zz, minY, maxY); int worldPointHeight = session.getHighestTerrainBlock(xx, zz, minY, maxY);
int pointHeight = (256 * (worldPointHeight - minY)) / selHeight; int pointHeight = Math.min(255, (256 * (worldPointHeight - minY)) / selHeight);
int x = xx - minX; int x = xx - minX;
int z = zz - minZ; int z = zz - minZ;
heightArray[x][z] = (byte) pointHeight; heightArray[x][z] = (byte) pointHeight;