public void Execute() { for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < 16; y++) { if (chunkData.Blocks[BlockExtensions.GetBlockIndex(new int3(x, y, z))].IsEmpty()) { continue; } for (int i = 0; i < 6; i++) { var direction = (Direction)i; if (Check(BlockExtensions.GetPositionInDirection(direction, x, y, z))) { CreateFace(direction, new int3(x, y, z)); } } } } } }
private bool Check(int3 position) { if (position.x >= 16 || position.z >= 16 || position.x <= -1 || position.z <= -1 || position.y <= -1) { return(true); } if (position.y >= 16) { return(false); } return(chunkData.Blocks[BlockExtensions.GetBlockIndex(position)].IsEmpty()); }