@Override
    public short[] getTerrainData(int px, int pz, int sx, int sz)
    {
        short[] res = base.getTerrainData(px, pz, sx, sz);

        for (int x = 0; x < sx; x++)
            for (int z = 0; z < sz; z++)
            {
                int y;
                int d = depth;
                boolean paint = false;
                for (y = Chunk.MAP_HEIGHT - 1; y >= 0; y--)
                {
                    int i = z + sz * (x + sx * y);
                    if (res[i] == 0)
                    {
                        d = depth;
                        paint = y <= maxHeight && y >= minHeight;
                    }
                    else
                    {
                        if (d > 0 && (surfaceBlock == 0 || res[i] == surfaceBlock) && paint)
                            res[i] = overlayBlock;
                        d--;
                    }
                }
            }

        return res;
    }