Optimized setBlock method