public static void setBlock(int x, int y, int z, byte[][] chunk, byte b) {
        //if the Block section the block is in hasn't been used yet, allocate it
        if (chunk[y >> 4] == null) {
            chunk[y >> 4] = new byte[16 * 16 * 16];
        }
        if (!(y <= 256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0)) {
            return;
        }
        try {
            chunk[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = b;
        } catch (Exception e) {
            // do nothing
        }
    }