public class HeightMapAgent {
public static void scanChunk(Chunk chunk) {
try {
HeightMap map = HeightMap.getHeightMap(MinimapUtils.getWorldName());
synchronized (map) {
HeightChunk hchunk = map.getChunk(chunk.xPosition, chunk.zPosition, true);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
int h = getHighestBlock(chunk, x, z);
if (h > -1) {
byte id = (byte) chunk.getBlockID(x, h, z);
byte data = (byte) chunk.getBlockMetadata(x, h, z);
// Check if block above is snow
if (chunk.getBlockID(x, h + 1, z) == 78) {
id = 78;
}
hchunk.setHeight(x, z, (short) h);
hchunk.setBlockId(x, z, id);
hchunk.setData(x, z, data);
}
}
}
}
}